stanfordnlp/cocoa

How to solve problems in Chat with the bot

Mocchaso opened this issue · 3 comments

I'm trying Chat with the bot in the command line interface, and web interface.
When then, I faced some problems.

In the command line interface, TypeError was occurred.
I can't solve this error in myself.
I'm describing later about this error in detail.

In the web interface, no error was occurred, but I can't understand
what to do after the contents described below are output.

What should I do in each section?

Preparation of inputting commands

Stored pre-trained models below:

craigslistbargain/
 ├ checkpoint/
 │ └ lf2lf/
 │   └ config.json
 │   └ model_best.pt
 ├ mappings/
 │ └ lf2lf/
 │   └ kb.glove.pt
 │   └ vocab.pkl
 ├ model.pkl
 ├ price_tracker.pkl
 ├ templates.pkl

Command line interface

input:

PYTHONPATH=. python ../scripts/generate_dataset.py --schema-path data/craigslist-schema.json --scenarios-path data/dev-scenarios.json --results-path bot-chat-transcripts.json --max-examples 20 --agents rulebased cmd --price-tracker price_tracker.pkl --agent-checkpoints checkpoint/lf2lf/model_best.pt "" --max-turns 20 --random-seed 1 --sample --temperature 0.2

output:

[nltk_data] Downloading package punkt to /home/mocchaso/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
[nltk_data] Downloading package stopwords to
[nltk_data]     /home/mocchaso/nltk_data...
[nltk_data]   Package stopwords is already up-to-date!
Traceback (most recent call last):
  File "../scripts/generate_dataset.py", line 70, in <module>
    for name, model_path in zip(args.agents, args.agent_checkpoints)]
  File "/mnt/c/users/administrator/my_graduation_research/cocoa_src/craigslistbargain/systems/__init__.py", line 14, in get_system
    templates = Templates.from_pickle(args.templates)
  File "/mnt/c/users/administrator/my_graduation_research/cocoa_src/cocoa/model/generator.py", line 81, in from_pickle
    templates = read_pickle(path)
  File "/mnt/c/users/administrator/my_graduation_research/cocoa_src/cocoa/core/util.py", line 28, in read_pickle
    with open(path, 'rb') as fin:
TypeError: coercing to Unicode: need string or buffer, NoneType found

Web interface

input

PYTHONPATH=. python web/chat_app.py --port 5000 --config web/app_params.json --schema-path data/craigslist-schema.json --scenarios-path data/dev-scenarios.json --output web_output

output:

[nltk_data] Downloading package punkt to /home/mocchaso/nltk_data...
[nltk_data]   Package punkt is already up-to-date!
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
1 systems loaded
human
App setup complete
  1. it seems your template path is missing from the cmd line arguments.
  2. go to localhost:5000

@hhexiy
Thank you for commenting.
I could use both command line interface and web interface!

However, I can't use between human and rulebased in web interface.
I guess that I should modify in chat_app.py line 81, but I can't understand what I should input arguments of RulebasedSystem.

Could you tell me what I should input arguments?

systems = {HumanSystem.name(): HumanSystem()}
↓
systems = {HumanSystem.name(): HumanSystem(), RulebasedSystem.name(): RulebasedSystem(?)}

I'm writing that I've resolved above a problem.

When I modified line 81 in chat_app.py and I inputted command below, I could use between human and rulebased in web interface!

systems = {HumanSystem.name(): HumanSystem()}
↓
systems = {HumanSystem.name(): HumanSystem(), RulebasedSystem.name(): get_system("rulebased", args)}

※get_system() is in my_task/systems/__init__.py
PYTHONPATH=. python web/chat_app.py --port 5000 --config web/app_params.json --schema-path data/craigslist-schema.json --scenarios-path data/dev-scenarios.json --output web_output --price-tracker ./price_tracker.pkl --template ./templates.pkl --policy ./model.pkl