fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

Inference in the IWSLT23 Simultaneous ST baseline example fails.

Open bhaddow opened this issue 1 year ago • 0 comments

🐛 Bug

Inference in the IWSLT23 Simultaneous ST baseline example fails.

To Reproduce

Following https://github.com/facebookresearch/fairseq/tree/iwslt2023/examples/simultaneous_translation#inference--evaluation

  1. Download the en-de model
  2. Run simuleval, as specified in the documentation

First error:

Traceback (most recent call last):
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/bin/simuleval", line 33, in <module>
    sys.exit(load_entry_point('simuleval', 'console_scripts', 'simuleval')())
  File "/mnt/startiger0/saga/raid0/bhaddow/code/SimulEval/simuleval/cli.py", line 47, in main
    system, args = build_system_args()
  File "/mnt/startiger0/saga/raid0/bhaddow/code/SimulEval/simuleval/utils/agent.py", line 128, in build_system_args
    system_class.add_args(parser)
  File "/mnt/startiger0/saga/raid0/bhaddow/code/fairseq/github/fairseq/models/streaming/agents/fairseq_pipeline.py", line 26, in add_args
    parser.add_argument(
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1386, in add_argument
    return self._add_action(action)
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1749, in _add_action
    self._optionals._add_action(action)
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1590, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1400, in _add_action
    self._check_conflict(action)
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1539, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/lib/python3.8/argparse.py", line 1548, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --device: conflicting option string: --device

On fixing this, I get the error:

Traceback (most recent call last):
  File "/home/shared/bhaddow/anaconda3/envs/simul-st-rl/bin/simuleval", line 33, in <module>
    sys.exit(load_entry_point('simuleval', 'console_scripts', 'simuleval')())
  File "/mnt/startiger0/saga/raid0/bhaddow/code/SimulEval/simuleval/cli.py", line 56, in main
    evaluator(system)
  File "/mnt/startiger0/saga/raid0/bhaddow/code/SimulEval/simuleval/evaluator/evaluator.py", line 216, in __call__
    output_segment = system.pushpop(input_segment)
  File "/mnt/startiger0/saga/raid0/bhaddow/code/SimulEval/simuleval/agents/agent.py", line 146, in pushpop
    return self.pop(states)
TypeError: pop() takes 1 positional argument but 2 were given

I have fixed the issue here: https://github.com/bhaddow/fairseq/blob/iwslt2023/fairseq/models/streaming/agents/fairseq_pipeline.py and happy to make a PR.

Code sample

Expected behavior

simuleval should run without error, and produce the output in the documentation

Environment

  • fairseq Version: iwslt2023 branch HEAD
  • PyTorch Version: 2.0.0+cu117
  • OS: Ubuntu 20.04
  • How you installed fairseq: source
  • Build command you used: pip install -e .
  • Python version: 3.8.16
  • CUDA/cuDNN version: 11.4
  • GPU models and configuration:
  • Any other relevant information:

Additional context

bhaddow avatar Apr 21 '23 16:04 bhaddow