Skip to content
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
@ButteredGroove

Description

@ButteredGroove

Steps to reproduce

  1. Ubuntu 16.04, Python 3.7, CUDA 9.0 install
  2. pip3 install pytext-nlp
  3. git clone https://github.com/NVIDIA/apex
  4. cd apex
  5. pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
  6. cd ..
  7. wget https://fb.me/semanticparsingdialog
  8. unzip top-dataset-semantic-parsing.zip
  9. Grab yourself a copy of https://github.com/facebookresearch/pytext/blob/master/demo/configs/rnng.json
  10. Edit rnng.json to point "train_filename" to top-dataset-semantic-parsing/train.tsv
  11. Edit rnng.json to point "test_filename" to top-dataset-semantic-parsing/test.tsv
  12. Edit rnng.json to point "eval_filename" to top-dataset-semantic-parsing/eval.tsv
  13. Train a model. It'll take around an hour:
    pytext train < rnng.json
  14. Run predict step:
    pytext predict-py --model-file=/tmp/model.pt
  15. 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
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions