question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[examples] text_classification/run_pl.sh error

See original GitHub issue
cd examples/text-classification
./run_pl.sh

trains for 1 epoch, tests 12/13 steps, then fails with the following traceback

/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/utilities/warnings.py:18: UserWarning: The dataloader, test dataloader 0, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` in the `DataLoader` init to improve performance.
  warnings.warn(*args, **kwargs)
Testing:  92%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ   | 12/13 [00:00<00:00, 14.67it/s]Traceback (most recent call last):
  File "run_pl_glue.py", line 195, in <module>
    trainer.test(model)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 894, in test
    self.fit(model)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 704, in fit
    self.single_gpu_train(model)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/distrib_parts.py", line 477, in single_gpu_train
    self.run_pretrain_routine(model)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 819, in run_pretrain_routine
    self.run_evaluation(test_mode=True)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/evaluation_loop.py", line 374, in run_evaluation
    eval_results)
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/logging.py", line 107, in process_output
    for k, v in output.items():
AttributeError: 'NoneType' object has no attribute 'items'
  File "/home/shleifer/.conda/envs/nb/lib/python3.7/site-packages/pytorch_lightning/trainer/logging.py", line 107, in process_output
    for k, v in output.items():
AttributeError: 'NoneType' object has no attribute 'items'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
divkakwanicommented, May 23, 2020

Removing the test_end method in BaseTransformer (file: https://github.com/huggingface/transformers/blob/master/examples/lightning_base.py) solved the issue for me.

From my understanding, what is happening here is that at the end of testing, test_end is being called which is just returning None and that’s why we are getting the error.

test_end is actually deprecated now in favor of test_epoch_end. In run_pl_glue.py we are using test_epoch_end whereas in lightning_base.py, we are using test_end. So if we have both of them, then I think only test_end will be called. So if we just remove it, we will have a call to test_epoch_end which will give us the correct result.

0reactions
stas00commented, Jul 25, 2020

It looks like this particular issue has already been fixed (test_end is no more in master), not in a PR suggested in https://github.com/huggingface/transformers/issues/4214#issuecomment-632988310, but elsewhere, so this issue can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to fix the issue "Command /bin/sh failed with exit code 1 ...
I used a cocoa static library in my application. When I compile my library I got the following error:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found