facebookresearch/ParlAI

chat services should use create_agent(requireExist=True)

Open

#3,017 opened on 2020年8月27日

GitHub で見る
 (6 comments) (0 reactions) (0 assignees)Python (10,371 stars) (2,089 forks)batch import
Help WantedMinornever-stale

説明

I would like to uso the broswer chat with my already trained model saved in my host. Actually, my config.yml file is:

tasks:
  default:
    onboard_world: MessengerBotChatCovidWorld
    task_world: MessengerBotChatTaskWorld
    timeout: 1800
    agents_required: 1
task_name: chatbot
world_module: parlai.chat_service.tasks.chatbot.worlds
overworld: MessengerOverworld
max_workers: 30
opt:
  debug: True
  models:
    covid90M:
      model: transformer/generator
      model_file: zoo:covid/covid90M
      interactive_mode: True
      no_cuda: False
additional_args:
  page_id: 1

I put my model and all the other files (.valid, .dict, .chekpoint, etc.) in a 'covid' repository inside the zoo directory. When I try to run the server with python3 parlai/chat_service/services/browser_chat/run.py --config-path parlai/chat_service/tasks/covid_task_browser/config.yml --port 10001 get the following error (as i kinda expected):

Traceback (most recent call last):
  File "parlai/chat_service/services/browser_chat/run.py", line 54, in <module>
    run(opt)
  File "parlai/chat_service/services/browser_chat/run.py", line 41, in run
    manager = BrowserManager(opt)
  File "/Users/asialucchi/Desktop/ParlAI/parlai/chat_service/services/websocket/websocket_manager.py", line 54, in __init__
    self._complete_setup()
  File "/Users/asialucchi/Desktop/ParlAI/parlai/chat_service/services/websocket/websocket_manager.py", line 67, in _complete_setup
    self._load_model()
  File "/Users/asialucchi/Desktop/ParlAI/parlai/chat_service/services/websocket/websocket_manager.py", line 81, in _load_model
    model_params[model] = create_agent(model_opt).share()
  File "/Users/asialucchi/Desktop/ParlAI/parlai/core/agents.py", line 386, in create_agent
    opt['model_file'] = modelzoo_path(opt.get('datapath'), opt['model_file'])
  File "/Users/asialucchi/Desktop/ParlAI/parlai/core/build_data.py", line 435, in modelzoo_path
    f'Could not find pretrained model in {module_name} or {module_name_}.'
ImportError: Could not find pretrained model in parlai.zoo.covid.build or parlai.zoo.covid.build.

From my understanding, I need to have a build file that will download the model somewhere to get it work... is there a way to just make the config use the model file I have locally? Without downloading it?

コントリビューターガイド