stanfordnlp / cocoa

Framework for learning dialogue agents in a two-player game setting.
MIT License
158 stars 62 forks source link

Question: Cannot execute craigslistbargain/web/chat_app.py #50

Closed Mocchaso closed 5 years ago

Mocchaso commented 5 years ago

Hello.

In order to try to use cocoa system, I added to write paths below to /home/(user_name)/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/easy-install.pth.

After that, I ran craigslistbargain/web/chat_app.py on Python 2.7.15.
However, this execution failed. The error is as follows:

Traceback (most recent call last):
  File "chat_app.py", line 19, in <module>
    from core.scenario import Scenario
ImportError: No module named scenario


What should I do?
I would appreciate if you could teach the solution.

Environment

hhexiy commented 5 years ago

You don't need to add all the paths. Have you run python setup.py develop? Please follow installation instruction here: https://github.com/stanfordnlp/cocoa#installation

Then just run the commands in the craigslist directory.

Mocchaso commented 5 years ago

@hhexiy Thank you very much for replying.

Yes, I ran pip install -r requirements.txt and python setup.py develop, with reading Section: installation. However, I failed to run all in patterns below. What should I do to run chat_app.py...?

hhexiy commented 5 years ago

See https://github.com/stanfordnlp/cocoa#web.

cd craigslistbargain;
PYTHONPATH=. python web/chat_app.py --port 5000 --config web/app_params.json --schema-path <path-to-schema> --scenarios-path <path-to-scenarios> --output <output-dir>
Mocchaso commented 5 years ago

I'm trying a Section: Building the bot, Use the modular approach, 2. Parse the training dialogues.

When I executed first command in this section, an error occurred. How can I resolve this error?

Error

Traceback (most recent call last):
  File "parse_dialogue.py", line 95, in <module>
    print generator.retrieve('<start>', context_tag='<start>', tag=action, category='car', role='seller').template
  File "/mnt/c/users/administrator/my_sotuken_src/cocoa-master/cocoa/model/generator.py", line 55, in retrieve
    candidates = candidates.iloc[ids]
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 1478, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 2091, in _getitem_axis
    return self._get_list_axis(key, axis=axis)
  File "/home/mocchaso/.pyenv/versions/anaconda3-5.3.0/envs/py27/lib/python2.7/site-packages/pandas/core/indexing.py", line 2073, in _get_list_axis
    raise IndexError("positional indexers are out-of-bounds")
IndexError: positional indexers are out-of-bounds
hhexiy commented 5 years ago

hmm. I cannot reproduce the error. Can you check if you pandas version is pandas=0.20.3=py27_0? I also added environment.yml here: https://github.com/stanfordnlp/cocoa/blob/master/environment.yml

Mocchaso commented 5 years ago

Thank you for adding environment.yml. When I downgraded pandas from 0.23.4 to 0.20.3, I could finished executing Section: Parse the training dialogues.

However, I couldn't copy an environment from environment.yml. The following error occurred.

$ conda env create --file environment.yml
(Other logs were outputted)
Could not find a version that satisfies the requirement cocoa==0.1

After comment out cocoa==0.1, the following error occurred.

$ conda env create --file environment.yml
(Other logs were outputted)
Could not find a version that satisfies the requirement en-core-web-sm==1.2.0

After comment out en-core-web-sm==1.2.0, command conda env create --file environment.yml succeeded.

If I execute python setup.py develop necessarily, is it ok to delete cocoa==0.1 and en-core-web-sm==1.2.0 in environment.yml?

hhexiy commented 5 years ago

That should be fine. en-core-web-sm is the Spacy model that you can download later if needed.

Mocchaso commented 5 years ago

OK, thank you very much for many replying!