Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch may not have the copy method #700

Closed
matthew-z opened this issue Jan 17, 2020 · 0 comments · Fixed by #701
Closed

batch may not have the copy method #700

matthew-z opened this issue Jan 17, 2020 · 0 comments · Fixed by #701
Labels
bug Something isn't working

Comments

@matthew-z
Copy link
Contributor

matthew-z commented Jan 17, 2020

🐛 Bug

In this commit: 48b797f

The training batch is copied before transfer_batch_to_gpu , but a batch may not have the copy method. Thus, the following error will be raised in some cases (e.g., the batch is a tuple ):

Traceback (most recent call last):
  File "scripts/msmacro.py", line 113, in <module>
    main()
  File "scripts/msmacro.py", line 109, in main
    trainer.fit(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 405, in fit
    self.single_gpu_train(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/distrib_parts.py", line 441, in single_gpu_train
    self.run_pretrain_routine(model)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/trainer.py", line 539, in run_pretrain_routine
    self.train()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 332, in train
    self.run_training_epoch()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 385, in run_training_epoch
    output = self.run_training_batch(batch, batch_idx)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 504, in run_training_batch
    loss = optimizer_closure()
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 473, in optimizer_closure
    split_batch, batch_idx, opt_idx, self.hiddens)
  File "/home/zhaohao/Documents/pytorch-lightning/pytorch_lightning/trainer/training_loop.py", line 589, in training_forward
    batch = self.transfer_batch_to_gpu(batch.copy(), gpu_id)
AttributeError: 'tuple' object has no attribute 'copy'
@matthew-z matthew-z added the bug Something isn't working label Jan 17, 2020
@matthew-z matthew-z changed the title tuple batch does not have copy metod batch may not have the copy method Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant