nyu-mll / jiant-v1-legacy

The jiant toolkit for general-purpose text understanding models
MIT License
21 stars 9 forks source link

Error in edgeprobe_bert #1115

Open jeswan opened 4 years ago

jeswan commented 4 years ago

Issue by sagnik Wednesday Sep 16, 2020 at 19:13 GMT Originally opened as https://github.com/nyu-mll/jiant/issues/1115


I am trying to run a probing test on Ontonotes SRL data with BERT as the pretrained model.

This:

(jiant) user:jiant$ python main.py --config_file jiant/config/edgeprobe/edgeprobe_bert.conf -o "target_tasks=edges-srl-ontonotes,exp_name=exp_bert_srl_ontonotes"

gives the following error:

Traceback (most recent call last):
  File "main.py", line 16, in <module>
    main(sys.argv[1:])
  File "/home/user/jiant/jiant/__main__.py", line 664, in main
    phase="target_train",
  File "/home/user/jiant/jiant/trainer.py", line 493, in train
    tasks, batch_size, train_params, optimizer_params, scheduler_params, phase
  File "/home/user/jiant/jiant/trainer.py", line 330, in _setup_training
    pad_dict = instance.get_padding_lengths()
  File "/home/user/anaconda3/envs/jiant/lib/python3.6/site-packages/allennlp/data/instance.py", line 81, in get_padding_lengths
    lengths[field_name] = field.get_padding_lengths()
  File "/home/user/anaconda3/envs/jiant/lib/python3.6/site-packages/allennlp/data/fields/text_field.py", line 128, in get_padding_lengths
    padding_lengths['num_tokens'] = max(num_tokens)
ValueError: max() arg is an empty sequence
Traceback (most recent call last):
  File "main.py", line 27, in <module>
    raise e  # re-raise exception, in case debugger is attached.
  File "main.py", line 16, in <module>
    main(sys.argv[1:])
  File "/home/user/jiant/jiant/__main__.py", line 664, in main
    phase="target_train",
  File "/home/user/jiant/jiant/trainer.py", line 493, in train
    tasks, batch_size, train_params, optimizer_params, scheduler_params, phase
  File "/home/user/jiant/jiant/trainer.py", line 330, in _setup_training
    pad_dict = instance.get_padding_lengths()
  File "/home/user/anaconda3/envs/jiant/lib/python3.6/site-packages/allennlp/data/instance.py", line 81, in get_padding_lengths
    lengths[field_name] = field.get_padding_lengths()
  File "/home/user/anaconda3/envs/jiant/lib/python3.6/site-packages/allennlp/data/fields/text_field.py", line 128, in get_padding_lengths
    padding_lengths['num_tokens'] = max(num_tokens)
ValueError: max() arg is an empty sequence

Am I doing something stupid or you can reproduce this? I have previously run this successfully:

(jiant) user:jiant$ python main.py --config_file jiant/config/edgeprobe/edgeprobe_cove.conf -o "target_tasks=edges-coref-ontonotes,exp_name=ep_cove_demo_coref_ontonotes
jeswan commented 4 years ago

Comment by sagnik Wednesday Sep 16, 2020 at 19:23 GMT


This is with bert-base-uncased if that's required.

jeswan commented 4 years ago

Comment by sleepinyourhat Thursday Sep 17, 2020 at 16:59 GMT


@iftenney Is this familiar?

iftenney commented 3 years ago

I have not seen this before, possible that it's ingesting an empty batch somehow, thus num_tokens == []?

tanjatang commented 3 years ago

Hi jeswan,

did you solve the problem? I had the same problem and have no idea how to solve it. If it is possible, could you please give me some suggestions?