ParlAI icon indicating copy to clipboard operation
ParlAI copied to clipboard

BB3 RuntimeError: Need to set `model` argument to use create_agent.

Open fraferra opened this issue 3 years ago • 3 comments

Bug description Currently trying to fine-tune BB3 3B params but agent fails saying that model param is not passed.

Command entered: parlai train_model --search_decision compute --search_decision_do_search_reply search --search_server chatbot --memory_decision compute --model projects.bb3.agents.opt_bb3_agent:BlenderBot3Agent --validation-metric token_acc --validation-max-exs 50 --eval-batchsize 1 --model-file /ParlAI/data/models/v0.0.1/model --init-model zoo:bb3/bb3_3B/model --dict-file zoo:bb3/bb3_3B/model.dict --datatype train:stream --batchsize 1 --num_shots 10 --opt_server server --task custom_persona,msc --multitask-weights 5.0,1.0 --validation-patience 20 --num_epochs 10

Reproduction steps

  • Running on pyhton3.8, CUDA 11.2
  • Installed parlai manually calling python3.8 setup.py develop

Expected behavior Starting training and recognizing training params

Logs

Traceback (most recent call last):
  File "/usr/local/bin/parlai", line 11, in <module>
    load_entry_point('parlai', 'console_scripts', 'parlai')()
  File "/ParlAI/parlai/__main__.py", line 14, in main
    superscript_main()
  File "/ParlAI/parlai/core/script.py", line 325, in superscript_main
    return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
  File "/ParlAI/parlai/core/script.py", line 108, in _run_from_parser_and_opt
    return script.run()
  File "/ParlAI/parlai/scripts/train_model.py", line 1054, in run
    self.train_loop = TrainLoop(self.opt)
  File "/ParlAI/parlai/scripts/train_model.py", line 378, in __init__
    self.agent = create_agent(opt)
  File "/ParlAI/parlai/core/agents.py", line 479, in create_agent
    model = model_class(opt)
  File "/ParlAI/projects/bb3/agents/opt_bb3_agent.py", line 160, in __init__
    super().__init__(opt, shared)
  File "/ParlAI/projects/bb3/agents/r2c2_bb3_agent.py", line 411, in __init__
    agent = self._init_top_agent(agent_opts)
  File "/ParlAI/projects/bb3/agents/opt_bb3_agent.py", line 208, in _init_top_agent
    return create_agent(opt)
  File "/ParlAI/parlai/core/agents.py", line 479, in create_agent
    model = model_class(opt)
  File "/ParlAI/projects/bb3/agents/opt_bb3_agent.py", line 160, in __init__
    super().__init__(opt, shared)
  File "/ParlAI/projects/bb3/agents/r2c2_bb3_agent.py", line 411, in __init__
    agent = self._init_top_agent(agent_opts)
  File "/ParlAI/projects/bb3/agents/opt_bb3_agent.py", line 208, in _init_top_agent
    return create_agent(opt)
  File "/ParlAI/parlai/core/agents.py", line 485, in create_agent
    raise RuntimeError('Need to set `model` argument to use create_agent.')
RuntimeError: Need to set `model` argument to use create_agent.```


fraferra avatar Aug 06 '22 18:08 fraferra

@klshuster Just following up on this to see if it might be an issue from my side or a bug. I noticed it happens when calling this opt: https://github.com/facebookresearch/ParlAI/blob/b1acb681207559da56a787ba96e16f0e23697d92/projects/bb3/agents/opt_bb3_agent.py#L216

fraferra avatar Aug 10 '22 17:08 fraferra

Hi there, in #4747 I've included the training command used to train BB3 3B model. You'll need to adapt your training command to have the requisite arguments (swapping out the --init-model, and --task arguments with yours as specified above, of course)

For future readers, the training command can be found on the bb3 project page

klshuster avatar Aug 15 '22 23:08 klshuster

This issue has not had activity in 30 days. Please feel free to reopen if you have more issues. You may apply the "never-stale" tag to prevent this from happening.

github-actions[bot] avatar Sep 18 '22 00:09 github-actions[bot]