question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module 'parlai.tasks.wizard_of_wikipedia.agents' has no attribute 'create_agents'

See original GitHub issue

Bug description I got AttributeError: module 'parlai.tasks.wizard_of_wikipedia.agents' has no attribute 'create_agents' when I was running this command: parlai display_data -t wizard_of_wikipedia -dt train

Reproduction steps Apple Intel / MacOS 12.4 Conda python 3.9

Expected behavior View the training set of wizard_of_wikipedia.

Logs Please paste the command line output:

(parlai) ➜  data parlai display_data -t wizard_of_wikipedia -dt train
16:36:40 | Opt:
16:36:40 |     add_missing_turns: none
16:36:40 |     allow_missing_init_opts: False
16:36:40 |     batchsize: 1
16:36:40 |     chosen_topic_delimiter: '\n'
16:36:40 |     datapath: /Users/elfsong/Library/Python/3.8/lib/python/site-packages/data
16:36:40 |     datatype: train:ordered
16:36:40 |     dict_class: None
16:36:40 |     display_add_fields:
16:36:40 |     download_path: None
16:36:40 |     dynamic_batching: None
16:36:40 |     hide_labels: False
16:36:40 |     ignore_agent_reply: True
16:36:40 |     image_cropsize: 224
16:36:40 |     image_mode: raw
16:36:40 |     image_size: 256
16:36:40 |     include_checked_sentence: True
16:36:40 |     include_knowledge: True
16:36:40 |     include_knowledge_separator: False
16:36:40 |     init_model: None
16:36:40 |     init_opt: None
16:36:40 |     is_debug: False
16:36:40 |     label_type: response
16:36:40 |     loglevel: info
16:36:40 |     max_display_len: 1000
16:36:40 |     model: None
16:36:40 |     model_file: None
16:36:40 |     multitask_weights: [1]
16:36:40 |     mutators: None
16:36:40 |     num_examples: 10
16:36:40 |     num_topics: 5
16:36:40 |     override: {}
16:36:40 |     parlai_home: /Users/elfsong/Library/Python/3.8/lib/python/site-packages
16:36:40 |     starttime: Jul25_16-36
16:36:40 |     task: wizard_of_wikipedia
16:36:40 |     verbose: False
16:36:41 | creating task(s): wizard_of_wikipedia
Traceback (most recent call last):
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/worlds.py", line 1397, in _create_task_agents
    task_agents = my_module.create_agents(opt)  # type: ignore
AttributeError: module 'parlai.tasks.wizard_of_wikipedia.agents' has no attribute 'create_agents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/elfsong/Library/Python/3.8/bin/parlai", line 8, in <module>
    sys.exit(main())
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/__main__.py", line 14, in main
    superscript_main()
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/script.py", line 325, in superscript_main
    return SCRIPT_REGISTRY[cmd].klass._run_from_parser_and_opt(opt, parser)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/script.py", line 108, in _run_from_parser_and_opt
    return script.run()
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/scripts/display_data.py", line 109, in run
    return display_data(self.opt)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/scripts/display_data.py", line 71, in display_data
    world = create_task(opt, agent)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/worlds.py", line 1448, in create_task
    world = create_task_world(opt, user_agents, default_world=default_world)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/worlds.py", line 1412, in create_task_world
    task_agents = _create_task_agents(opt)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/worlds.py", line 1400, in _create_task_agents
    return create_task_agent_from_taskname(opt)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/core/teachers.py", line 2666, in create_task_agent_from_taskname
    task_agents = teacher_class(opt)
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/tasks/wizard_of_wikipedia/agents.py", line 290, in __init__
    self.rare_word_f1 = _build_rare_word_f1(opt['datapath'])
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/parlai/tasks/wizard_of_wikipedia/agents.py", line 170, in _build_rare_word_f1
    with PathManager.open(data_path) as f:
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/iopath/common/file_io.py", line 1062, in open
    bret = handler._open(path, mode, buffering=buffering, **kwargs)  # type: ignore
  File "/Users/elfsong/Library/Python/3.8/lib/python/site-packages/iopath/common/file_io.py", line 645, in _open
    return open(  # type: ignore
FileNotFoundError: [Errno 2] No such file or directory: '/Users/elfsong/Library/Python/3.8/lib/python/site-packages/data/wizard_of_wikipedia/data.json'

Additional context I found the instruction from https://parl.ai/projects/wizard_of_wikipedia/

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
daje0601commented, Jul 26, 2022

I just ran the first two commands to uninstall my current parlai, and re-install from git. Then the script displaying “wizard_of_wikipedia” can finally work. I guess the error is caused by the package in my pip source is not the latest version.

I am so happy to be of help. You’re right. If you install with pip install parlai, the latest version will not be downloaded. So you need git clone. 😃

1reaction
daje0601commented, Jul 26, 2022

Are you sure your parlai was installed correctly? I just ran parlai display_data -t wizard_of_wikipedia -dt train and it worked perfectly fine for me.

Hi @mojtaba-komeili! Thanks for your try. I installed parlai by the command pip install parlai, and then I tried parlai display_data --task twitter, that works well. However, when I tried the same script for “wizard_of_wikipedia”, I got the above error.

Hello, @Elfsong Did you solve this problem? I also had the same error and solved it.

!pip uninstall -q parlai -y 
!pip install -q  --progress-bar off git+https://github.com/facebookresearch/ParlAI.git 
!pip install -q fairseq
!parlai display_data -t wizard_of_wikipedia

For reference, It worked fine on my local machine with no issues and I ran into this problem when running in colab. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

'parlai.tasks.babi.agents' has no attribute create_agents #768
It seems to be a problems with permissions. I fixed it by doing: sudo mkdir /usr/local/lib/python3.5/dist-packages/parlai-0.1 ...
Read more >
Tasks and Datasets in ParlAI
In this tutorial we will go over the different ways a new task (or dataset) can be created.
Read more >
Wizard of Wikipedia: Knowledge-Powered ... - Papers With Code
Use of knowledge has so far proved difficult, in part because of the lack of a supervised learning benchmark task which exhibits knowledgeable...
Read more >
Jason Weston's research works | Google Inc., Mountain View ...
Deployed dialogue agents have the potential to integrate human feedback to continuously improve themselves. However, humans may not always provide explicit ...
Read more >
Conversational Modeling with Human Values, Social ...
6 Structure Extraction in Task-Oriented Dialogues with Slot Clustering . ... 4.1 Socially intelligent agents with mental state simulation and human values.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found