Skip to content

[Help Wanted] Reimplement Dump_beam for beam visualization #719

@ziorufus

Description

@ziorufus

Hello!
I'm trying to use the dump_beam parameter in the translate.py file, but I get this error:

Traceback (most recent call last):
  File "translate.py", line 29, in <module>
    main(opt)
  File "translate.py", line 18, in main
    opt.batch_size, opt.attn_debug)
  File "/kore-ns-groups/dh/aprosio/simp/OpenNMT-py-master/onmt/translate/Translator.py", line 210, in translate
    json.dump(self.translator.beam_accum,
AttributeError: 'Translator' object has no attribute 'translator'

By looking at the code, it seems that line 210 of Translator.py should be modified from json.dump(self.translator.beam_accum to json.dump(self.beam_accum, but it still does not work. No error is thrown now, but the beam file only contains: {"predicted_ids": [], "beam_parent_ids": [], "log_probs": [], "scores": []}. How can I get the correct output?
Note that the output file is correct.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions