allenai / scifact

Data and models for the SciFact verification task.
Other
215 stars 24 forks source link

key error #10

Closed vanessaliup closed 3 years ago

vanessaliup commented 3 years ago

Hi David, I am running this code in my Colab environment:

!python verify_covid.py "Oleandrin may help fight COVID-19" results/covid-report --n_documents=10 --rationale_selection_method=topk --verbose --keep_nei

and had this issue 2021-02-02 17:03:08.880513: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1 Initializing model. Traceback (most recent call last): File "verify_covid.py", line 145, in main() File "verify_covid.py", line 139, in main results = inference(args) File "verify_covid.py", line 59, in inference device,args.tf) File "/content/drive/My Drive/NLI-main/script/verisci/covid/rationale_selector.py", line 27, in init self.model = SentenceTransformer(model) File "/usr/local/lib/python3.6/dist-packages/sentence_transformers/SentenceTransformer.py", line 105, in init if config['version'] > version: KeyError: 'version'

I checked my config.json file and the contents are { "_num_labels": 2, "architectures": [ "RobertaForSequenceClassification" ], "attention_probs_dropout_prob": 0.1, "bad_words_ids": null, "bos_token_id": 0, "decoder_start_token_id": null, "do_sample": false, "early_stopping": false, "eos_token_id": 2, "finetuning_task": null, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 1024, "id2label": { "0": "LABEL_0", "1": "LABEL_1" }, "initializer_range": 0.02, "intermediate_size": 4096, "is_decoder": false, "is_encoder_decoder": false, "label2id": { "LABEL_0": 0, "LABEL_1": 1 }, "layer_norm_eps": 1e-05, "length_penalty": 1.0, "max_length": 20, "max_position_embeddings": 514, "min_length": 0, "model_type": "roberta", "no_repeat_ngram_size": 0, "num_attention_heads": 16, "num_beams": 1, "num_hidden_layers": 24, "num_return_sequences": 1, "output_attentions": false, "output_hidden_states": false, "output_past": true, "pad_token_id": 1, "prefix": null, "pruned_heads": {}, "repetition_penalty": 1.0, "task_specific_params": null, "temperature": 1.0, "top_k": 50, "top_p": 1.0, "torchscript": false, "type_vocab_size": 1, "use_bfloat16": false, "vocab_size": 50265 }

I can't figure out the solution myself. Do you have any clues? Thanks a lot!

dwadden commented 3 years ago

I'm looking at line 27 of rationale_selector.py, and it looks different from what I see in your error message. In particular, the SciFact code doesn't rely on SentenceTransformer.

Unfortunately, I can't offer support if you've modified the code. But if you get the same error using the unmodified code, feel free to post the error message and I can try to help debug!

dwadden commented 3 years ago

Closing for lack of new activity. Feel free to reopen if you're still stuck.