Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

chat services should use create_agent(requireExist=True) #3017

Open
aslucc opened this issue Aug 27, 2020 · 6 comments
Open

chat services should use create_agent(requireExist=True) #3017

aslucc opened this issue Aug 27, 2020 · 6 comments

Comments

@aslucc
Copy link

aslucc commented Aug 27, 2020

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?

@aslucc
Copy link
Author

aslucc commented Aug 27, 2020

I figured out the problem was I put my files in the "zoo" repository, If I leave them out I don't need to use build or any other script. Now I am able to start the server anche client processes, but when I chat with the model in browser chat I get responses like:

__null__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__ __unk__

or

__null__ __null__

or

__null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__ __null__

When I chat with the same model with intercative.py it works. (answers with proper words)

Edit:
I noticed that when I start the model with intercative I have in the output
Total parameters: 87,508,992 (87,508,992 trainable)
but when I start the same model with browser chat I have in the output

INFO | No model with opt yet at: covid/covid90M(.opt)
Total parameters: 3,511,200 (2,896,800 trainable)

@aslucc aslucc changed the title Broswer chat with pre-trained model saved locally Broswer chat: __unk__ responses Aug 27, 2020
@stephenroller
Copy link
Contributor

I don't think you want zoo:covid/covid_90M. I think you want covid/covid_90M

@aslucc
Copy link
Author

aslucc commented Aug 27, 2020

Thanks, I had figured out that what I wanted was my model to be outside the zoo.
The unk issue was solved using path parlai/covid/covid90M instead of just covid/covid90M.
I initially thought that I was supposed to start my path on the same place the zoo was, it still makes no sense to me why it uploaded a 3M model and from where when I used path covid/covid90M.

@aslucc aslucc closed this as completed Aug 27, 2020
@stephenroller
Copy link
Contributor

Yeah that looks like it initiated a new model from scratch. Our chat services should be preventing that

@stephenroller stephenroller reopened this Aug 27, 2020
@stephenroller
Copy link
Contributor

Leaving this task open because we need to double check that chat services has requireExists=True on the call to create_agent.

@github-actions
Copy link

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 github-actions bot added the stale label Sep 28, 2020
@stephenroller stephenroller changed the title Broswer chat: __unk__ responses chat services should use create_agent(requireExist=True) Sep 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants