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

Getting error when running examples/display_data.py #2514

Open
tibnb545 opened this issue Mar 28, 2020 · 7 comments
Open

Getting error when running examples/display_data.py #2514

tibnb545 opened this issue Mar 28, 2020 · 7 comments

Comments

@tibnb545
Copy link

Bug description
After running

git clone https://github.com/facebookresearch/ParlAI.git
cd ParlAI; python setup.py develop

to install ParlAI, when trying to run the first example script

python examples/display_data.py -t babi:task1k:1

there is an error which is shown below.

Logs

Traceback (most recent call last):
  File "examples/display_data.py", line 23, in <module>
    display_data(opt)
  File "/home/user1/ParlAI/parlai/scripts/display_data.py", line 46, in display_data
    world.parley()
  File "/home/user1/ParlAI/parlai/core/worlds.py", line 342, in parley
    agents[0].observe(validate(acts[1]))
  File "/home/user1/ParlAI/parlai/core/teachers.py", line 444, in observe
    self.metrics.evaluate_response(observation, self.lastY)
  File "/home/user1/ParlAI/parlai/core/metrics.py", line 714, in evaluate_response
    self.add(f'bleu-{k}', BleuMetric.compute(prediction, labels, k))
  File "/home/user1/ParlAI/parlai/core/metrics.py", line 585, in add
    self._data[key] = self._data.get(key) + value
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
@stephenroller
Copy link
Contributor

stephenroller commented Mar 29, 2020

Thanks for reporting.

I suspect the issue is that nltk isn’t installed, but the system should work around that.

I’ll put out a fix shortly

@tgmerritt
Copy link

tgmerritt commented May 1, 2020

Having similar issue -

Traceback (most recent call last):
  File "/Users/tyler/.pyenv/versions/3.7.2/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/Users/tyler/ParlAI/parlai/core/worlds.py", line 1322, in run
    world.parley()
  File "/Users/tyler/ParlAI/parlai/core/worlds.py", line 349, in parley
    agents[0].observe(validate(acts[1]))
  File "/Users/tyler/ParlAI/parlai/core/teachers.py", line 445, in observe
    self.metrics.evaluate_response(observation, self.lastY)
  File "/Users/tyler/ParlAI/parlai/core/metrics.py", line 722, in evaluate_response
    self.add(f'bleu-{k}', BleuMetric.compute(prediction, labels, k))
  File "/Users/tyler/ParlAI/parlai/core/metrics.py", line 591, in add
    self._buffer[key] = self._buffer.get(key) + value
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Running python examples/train_model.py -t babi:task10k:1 -mf /tmp/babi_memnn -bs 1 -nt 4 -eps 5 -m memnn --no-cuda from the Quick Start guide

The training hasn't errored out just yet ~

I seem to have nltk already installed - but missing 'wheel'

pip3 install nltk
Requirement already satisfied: nltk in ./.pyenv/versions/3.7.2/lib/python3.7/site-packages/nltk-3.4.5-py3.7.egg (3.4.5)
Requirement already satisfied: six in ./.pyenv/versions/3.7.2/lib/python3.7/site-packages (from nltk) (1.14.0)
Could not build wheels for nltk, since package 'wheel' is not installed.
Could not build wheels for six, since package 'wheel' is not installed.

I installed the wheel package and I'm still seeing the same error.

I added some logging to check values passed into this function:

[loading fbdialog data:/Users/tyler/ParlAI/data/bAbI/tasks_1-20_v1-2/en-valid-10k-nosf/qa1_train.txt]
Before failing line - self is {} and key is exs and value is 1
Before failing line - self is {'exs': SumMetric(1)} and key is accuracy and value is 1
Before failing line - self is {'exs': SumMetric(1), 'accuracy': ExactMatchMetric(1)} and key is f1 and value is 1
Before failing line - self is {'exs': SumMetric(1), 'accuracy': ExactMatchMetric(1), 'f1': F1Metric(1)} and key is bleu-4 and value is None

@Meai1
Copy link

Meai1 commented May 11, 2020

EDIT: I simply added a line checking whether the value is None at metrics.py:590 and now some samples seem to run fine:

if self._threadsafe and self._worker:
self._buffer[key] = self._buffer.get(key) + value
else:
self._data[key] = self._data.get(key) + value

        if value is not None:  # <---- new line
            if self._threadsafe and self._worker:
                self._buffer[key] = self._buffer.get(key) + value
            else:
                self._data[key] = self._data.get(key) + value

@stephenroller
Copy link
Contributor

What version of python were you on?

@Meai
Copy link

Meai commented May 13, 2020

3.8.2

@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.

@stephenroller
Copy link
Contributor

Still needs to be fixed.

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

5 participants