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

Documentation Mismatch and AssertionError in language_translation #1245

Open
J-StrawHat opened this issue Apr 13, 2024 · 0 comments
Open

Documentation Mismatch and AssertionError in language_translation #1245

J-StrawHat opened this issue Apr 13, 2024 · 0 comments

Comments

@J-StrawHat
Copy link

Context

  • Pytorch version: 1.13.0
  • Operating System and version: Ubuntu 20.04.6 LTS

Expected Behavior

The README in the examples/language_translation directory states that any language can be used for translation and specifically mentions using English to French translation (python3 main.py --src en --tgt fr).

Current Behavior

However, when attempting to run the training on translation with English to French, the program throws an AssertionError indicating that the language pair must be either ('de', 'en') or ('en', 'de').

Steps to Reproduce

  1. Run the command: python3 -m spacy download fr
  2. Run the training command: python3 main.py --src en --tgt fr
  3. Observe the AssertionError indicating the supported language pairs are only English and German.
    ...

Failure Logs [if any]

$ python3 main.py --src en --tgt fr
python3 main.py --src en --tgt fr
Translation task: en -> fr
Using device: cpu
Traceback (most recent call last):
  File "main.py", line 306, in <module>
    main(args)
  File "main.py", line 201, in main
    train_dl, valid_dl, src_vocab, tgt_vocab, _, _, special_symbols = get_data(opts)
  File "....../language_translation/src/data.py", line 36, in get_data
    train_iterator = Multi30k(split="train", language_pair=(src_lang, tgt_lang))
  File "....../anaconda3/envs/torch_v1_13_0/lib/python3.8/site-packages/torchtext/data/datasets_utils.py", line 193, in wrapper
    return fn(root=new_root, *args, **kwargs)
  File "....../anaconda3/envs/torch_v1_13_0/lib/python3.8/site-packages/torchtext/data/datasets_utils.py", line 155, in new_fn
    result.append(fn(root, item, **kwargs))
  File "....../anaconda3/envs/torch_v1_13_0/lib/python3.8/site-packages/torchtext/datasets/multi30k.py", line 83, in Multi30k
    assert tuple(sorted(language_pair)) == (
AssertionError: language_pair must be either ('de','en') or ('en', 'de')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant