Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Unk replacement doesn't work with the transformer #225

Description

@pmichel31415

I get the following error when decoding using the transformer with --replace-unk:

Traceback (most recent call last):
  File "../../../generate.py", line 569, in <module>
    main()
  File "../../../generate.py", line 474, in main
    generate(args)
  File "../../../generate.py", line 555, in generate
    models=models, args=args, task=task, dataset_split=args.gen_subset
  File "../../../generate.py", line 142, in _generate_score
    args, task, dataset_split, translations, align_dict
  File "../../../generate.py", line 220, in _iter_first_best_bilingual
    remove_bpe=args.remove_bpe,
  File "/home/pmichel1/.local/lib/python3.6/site-packages/fairseq-0.5.0-py3.6-linux-x86_64.egg/fairseq/utils.py", line 293, in post_process_prediction
    hypo_str = replace_unk(hypo_str, src_str, alignment, align_dict, tgt_dict.unk_string())
  File "/home/pmichel1/.local/lib/python3.6/site-packages/fairseq-0.5.0-py3.6-linux-x86_64.egg/fairseq/utils.py", line 283, in replace_unk
    src_token = src_tokens[alignment[i]]
IndexError: list index out of range

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions