pytorch/hub

demo not working for Translation: TypeError: cannot unpack non-iterable NoneType object

wise-east opened this issue · 7 comments

The example that I am trying to execute is: https://pytorch.org/hub/pytorch_fairseq_translation/

Whether it be in a local environment or Google Colab, I get the error:

----> 1 en2de = torch.hub.load('pytorch/fairseq', 'transformer.wmt19.en-de.single_model', tokenizer='moses', bpe='fastbpe')


7 frames
/root/.cache/torch/hub/pytorch_fairseq_master/fairseq/criterions/__init__.py in <module>()
     22     CRITERION_DATACLASS_REGISTRY,
     23 ) = registry.setup_registry(
---> 24     "--criterion", base_class=FairseqCriterion, default="cross_entropy"
     25 )
     26 

TypeError: cannot unpack non-iterable NoneType object

Steps to replicate:
open the google colab page linked to the tutorial at https://pytorch.org/hub/pytorch_fairseq_translation/ and execute the code.

Thanks for the report @wise-east , this notebook has indeed been broken for a while.

I also noticed that a few dependencies were missing: pip install hydra-core omegaconf bitarray.

@myleott since you authored the original file in #34, would you mind taking a look at this? Thanks!

@NicolasHug I can take a look at this

@dianaml0 @NicolasHug Is there any immediate solution for this? I'm trying to execute code in this notebook (provided by PyTorch), and I have the same error. Thank you.

I am unable to reproduce the issue right now, @AyushiNM @wise-east are you still seeing these errors if you update the missing dependencies? (#239 )

@dianaml0 it worked after including the new dependencies. I thought I had tried it with the new dependencies except for omegaconf, but maybe that was the missing piece? Anyways, thank you for looking into this.

Thanks @dianaml0 , indeed it looks like something was fixed on the main branch of the fairseq repo.

I merged the PR as it seems that the colab notebook runs properly now (I checked myself as well).

I tried to re-enable the fairseq-translation tests which are currently skipped, but got a torch error which is probably unrelated https://app.circleci.com/pipelines/github/pytorch/hub/1342/workflows/65d1b468-787c-45de-bbe5-87840cc8c5e5/jobs/1777 (looks like the machine somehow believed it didn't have GPUs....)

I'll try to investigate this in the future but since the notebook seems to be running, I'll close this issue.
Thanks!