This repository was archived by the owner on Nov 22, 2022. It is now read-only.
This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Attribute error during prediction step of hierarchical intent and slot filling example #879
Open
Description
Steps to reproduce
- Ubuntu 16.04, Python 3.7, CUDA 9.0 install
- pip3 install pytext-nlp
- git clone https://github.com/NVIDIA/apex
- cd apex
- pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
- cd ..
- wget https://fb.me/semanticparsingdialog
- unzip top-dataset-semantic-parsing.zip
- Grab yourself a copy of https://github.com/facebookresearch/pytext/blob/master/demo/configs/rnng.json
- Edit rnng.json to point "train_filename" to top-dataset-semantic-parsing/train.tsv
- Edit rnng.json to point "test_filename" to top-dataset-semantic-parsing/test.tsv
- Edit rnng.json to point "eval_filename" to top-dataset-semantic-parsing/eval.tsv
- Train a model. It'll take around an hour:
pytext train < rnng.json - Run predict step:
pytext predict-py --model-file=/tmp/model.pt - When prompted for a json example, try:
{"text": "traffic in Los Angeles"}
Observed Results
$ pytext predict-py --model-file=/tmp/model.pt
Loading model from model.pt...
please input a json example, the names should be the same with column_to_read in model training config:
{"text": "traffic in Los Angeles"}
Traceback (most recent call last):
File "/home/user/.local/bin/pytext", line 10, in <module>
sys.exit(main())
File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/user/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/user/.local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/user/.local/lib/python3.7/site-packages/pytext/main.py", line 407, in predict_py
pprint.pprint(task.predict([json.loads(line)])[0])
File "/home/user/.local/lib/python3.7/site-packages/pytext/task/task.py", line 216, in predict
model_inputs, context = self.data_handler.get_predict_iter(examples)
AttributeError: 'SemanticParsingTask' object has no attribute 'data_handler'
Expected Results
The expectation was to see predictions and scores.
Relevant Code
See above.
Metadata
Metadata
Assignees
Labels
No labels