diora icon indicating copy to clipboard operation
diora copied to clipboard

Error when predicting from NLI

Open filemon11 opened this issue 1 year ago • 0 comments

I get the following error, when parsing the multiNLI development split:

Traceback (most recent call last):
  File "/home/lukas/diora/diora/pytorch/diora/scripts/parse.py", line 241, in <module>
    run(options)
  File "/home/lukas/diora/diora/pytorch/diora/scripts/parse.py", line 231, in run
    file_writer.update(batch_map, trees)
  File "/home/lukas/diora/diora/pytorch/diora/scripts/parse.py", line 156, in update
    file_order = batch_map['file_order'][ii]
KeyError: 'file_order'

I am using the following command:

python pytorch/diora/scripts/parse.py \
    --retain_file_order \
    --batch_size 10 \
    --data_type nli \
    --elmo_cache_dir ./cache \
    --load_model_path ./diora-checkpoints/mlp-softmax/model.pt \
    --model_flags ./diora-checkpoints/mlp-softmax/flags.json \
    --experiment_path ./log/redone/model_periodic.pt \
    --validation_path ./data/multinli_1.0/multinli_1.0_dev_matched.jsonl \
    --validation_filter_length -1

It works without errors when omitting the --retain_file_order flag. But then I get the following error when running EVALB:

Traceback (most recent call last):
  File "/home/lukas/diora/diora/pytorch/diora/scripts/evalb.py", line 177, in <module>
    main(args)
  File "/home/lukas/diora/diora/pytorch/diora/scripts/evalb.py", line 110, in main
    nltk_tree = nltk.Tree.fromstring(line)
  File "/home/lukas/diora/venv/lib/python3.10/site-packages/nltk/tree/tree.py", line 680, in fromstring
    cls._parse_error(s, match, open_b)
  File "/home/lukas/diora/venv/lib/python3.10/site-packages/nltk/tree/tree.py", line 731, in _parse_error
    raise ValueError(msg)
ValueError: Tree.read(): expected '(' but got 'gold_label'
            at index 0.
                "gold_label..."
                 ^

with command

 python pytorch/diora/scripts/evalb.py     
    --evalb ./EVALB
    --evalb_config ./EVALB/diora.prm
    --out ./log/redone
    --pred ./log/redone/parse.jsonl
    --gold ./data/multinli_1.0/multinli_1.0_dev_matched.txt

How do I recreate the results from table 2 in the paper?

filemon11 avatar Feb 28 '24 10:02 filemon11