salesforce / decaNLP

The Natural Language Decathlon: A Multitask Challenge for NLP
BSD 3-Clause "New" or "Revised" License
2.34k stars 474 forks source link

UnboundLocalError: local variable 'wikisql_ids' referenced before assignment #36

Closed dfenglei closed 5 years ago

dfenglei commented 5 years ago

An UnboundLocalError occurred when executing the following command. nvidia-docker run -it --rm -v pwd:/decaNLP/ decanlp bash -c "python /decaNLP/predict.py --evaluate validation --path /decaNLP/mqan_wikisql --checkpoint_name model.pth --gpu 0 --tasks wikisql"

Arguments: {'best_checkpoint': '/decaNLP/mqan_wikisql/model.pth', 'bleu': False, 'checkpoint_name': 'model.pth', 'cove': None, 'data': '/decaNLP/.data/', 'dimension': 200, 'dropout_ratio': 0.0, 'embeddings': '/decaNLP/.embeddings', 'evaluate': 'validation', 'gpus': 0, 'intermediate_cove': None, 'load': None, 'lower': True, 'max_generative_vocab': 50000, 'max_output_length': 100, 'max_val_context_length': 400, 'model': 'MultitaskQuestionAnsweringNetwork', 'overwrite_predictions': False, 'path': '/decaNLP/mqan_wikisql', 'rnn_layers': 1, 'rouge': False, 'seed': 123, 'silent': False, 'task_to_metric': {'cnn_dailymail': 'avg_rouge', 'iwslt.en.de': 'bleu', 'multinli.in.out': 'em', 'schema': 'em', 'squad': 'nf1', 'srl': 'nf1', 'sst': 'em', 'wikisql': 'lfem', 'woz.en': 'joint_goal_em', 'zre': 'corpus_f1'}, 'tasks': ['wikisql'], 'transformer_heads': 3, 'transformer_hidden': 150, 'transformer_layers': 2, 'val_batch_size': [256]} Loading from /decaNLP/mqan_wikisql/model.pth Initializing Model Loading wikisql Loading cached data from /decaNLP/.data/wikisql/data/.cache/query_as_context/dev.jsonl/None Vocabulary has 33414 tokens from training Vocabulary has expanded to 33414 tokens 100% 2196017/2196017 [03:05<00:00, 11823.34it/s] Loading wikisql Loading cached data from /decaNLP/.data/wikisql/data/.cache/query_as_context/dev.jsonl/None device: 0 Preparing iterators MultitaskQuestionAnsweringNetwork has 11,136,116 parameters /decaNLP/mqan_wikisql/model/validation/wikisql.txt already exists -- this is where predictions are stored /decaNLP/mqan_wikisql/model/validation/wikisql.gold.txt already exists -- this is where ground truth answers are stored /decaNLP/mqan_wikisql/model/validation/wikisql.results.txt already exists -- this is where metrics are stored {"lfem":76.0954755967,"em":73.4829592685,"nf1":97.4454620976,"nem":74.2192138701}

Traceback (most recent call last): File "/decaNLP/predict.py", line 267, in run(args, field, splits, model) File "/decaNLP/predict.py", line 123, in run for i in wikisql_ids: UnboundLocalError: local variable 'wikisql_ids' referenced before assignment test@ubuntu:~/decaNLP$

bmccann commented 5 years ago

This should be fixed on https://github.com/salesforce/decaNLP/tree/pytorch_upgrade_041. Waiting to merge until I figure out why GPU memory usage seems to be a bit higher. You can run that branch with a lower --train_batch_tokens than the default for now though.

bmccann commented 5 years ago

Just merged it, so this should not be an issue anymore. Let me know if it is!