![](/img/trans.png)
[英]Keep trying getting the TypeError: '<' not supported between instances of 'int' and 'list' error
[英]Shift from single gpu to multiple gpu.Throws an error TypeError: '<' not supported between instances of 'list' and 'int'
我已經從使用單個gpu轉移到多個gpu。 該代碼引發錯誤
epoch main/loss validation/main/loss elapsed_time
Exception in main training loop: '<' not supported between instances of
'list' and 'int'
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/chainer_p36/lib/python3.6/site-
packages/chainer/training/trainer.py", line 318, in run
entry.extension(self)
File "/home/ubuntu/anaconda3/envs/chainer_p36/lib/python3.6/site-
packages/chainer/training/extensions/evaluator.py", line 157, in
__call__
result = self.evaluate()
File "/home/ubuntu/anaconda3/envs/chainer_p36/lib/python3.6/site-
packages/chainer/training/extensions/evaluator.py", line 206, in evaluate
in_arrays = self.converter(batch, self.device)
File "/home/ubuntu/anaconda3/envs/chainer_p36/lib/python3.6/site-
packages/chainer/dataset/convert.py", line 150, in concat_examples
return to_device(device, _concat_arrays(batch, padding))
File "/home/ubuntu/anaconda3/envs/chainer_p36/lib/python3.6/site-
packages/chainer/dataset/convert.py", line 35, in to_device
elif device < 0:
在重新啟動異常之前,將最終確定培訓師擴展和更新程序。
我試過沒有使用gpu它工作正常。 但是當使用單個gpu時,得到了內存不足的錯誤。所以,移動了p28xlarge實例,現在它拋出了上面的錯誤。問題出在哪里,如何解決?
num_gpus = 8
chainer.cuda.get_device_from_id(0).use()
3.#更新者
if num_gpus > 0:
updater = training.updater.ParallelUpdater(
train_iter,
optimizer,
devices={('main' if device == 0 else str(device)): device for
device in range(num_gpus)},
)
else:
updater = training.updater.StandardUpdater(train_iter, optimizer,
device=args.gpus)
4.和兒子.. 5.培訓:
trainer.run()
輸出 - epoch main / loss驗證/ main / loss elapsed_time主訓練循環中的異常:'list'和'int'實例之間不支持'<'
我期望輸出為
epoch main/loss validation/main/loss elapsed_time
1.
2.
3. and so on till it converge's.
當它將數據傳輸到指定device
時,它似乎是由Evaluator
擴展引起的錯誤。 你如何指定device
Evalutor.__init__
? 請注意,它應該是單個設備。 也許這個例子可以作為參考https://github.com/chainer/chainer/blob/master/examples/mnist/train_mnist_data_parallel.py
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.