When I run this code:
predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz", cuda_device=opts.cuda_device)
Send an error:
Traceback (most recent call last):
File "./semantic_role_labeling.py", line 52, in
main()
File "./semantic_role_labeling.py", line 19, in main
predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz", cuda_device=opts.cuda_device)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/predictors/predictor.py", line 275, in from_path
load_archive(archive_path, cuda_device=cuda_device),
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/archival.py", line 192, in load_archive
model = Model.load(
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/model.py", line 398, in load
return model_class._load(config, serialization_dir, weights_file, cuda_device, opt_level)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/model.py", line 295, in _load
model = Model.from_params(vocab=vocab, params=model_params)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/common/from_params.py", line 576, in from_params
return retyped_subclass.from_params(
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/common/from_params.py", line 611, in from_params
return constructor_to_call(**kwargs) # type: ignore
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp_models/structured_prediction/models/srl_bert.py", line 56, in init
self.bert_model = BertModel.from_pretrained(bert_model)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/transformers/modeling_utils.py", line 628, in from_pretrained
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
transformers == 2.9.1
allennlp==1.0.0
When I run this code: predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz", cuda_device=opts.cuda_device) Send an error: Traceback (most recent call last): File "./semantic_role_labeling.py", line 52, in
main()
File "./semantic_role_labeling.py", line 19, in main
predictor = Predictor.from_path("https://s3-us-west-2.amazonaws.com/allennlp/models/bert-base-srl-2019.06.17.tar.gz", cuda_device=opts.cuda_device)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/predictors/predictor.py", line 275, in from_path
load_archive(archive_path, cuda_device=cuda_device),
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/archival.py", line 192, in load_archive
model = Model.load(
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/model.py", line 398, in load
return model_class._load(config, serialization_dir, weights_file, cuda_device, opt_level)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/models/model.py", line 295, in _load
model = Model.from_params(vocab=vocab, params=model_params)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/common/from_params.py", line 576, in from_params
return retyped_subclass.from_params(
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp/common/from_params.py", line 611, in from_params
return constructor_to_call(**kwargs) # type: ignore
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/allennlp_models/structured_prediction/models/srl_bert.py", line 56, in init
self.bert_model = BertModel.from_pretrained(bert_model)
File "/usr/local/miniconda3/envs/myenv/lib/python3.8/site-packages/transformers/modeling_utils.py", line 628, in from_pretrained
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
transformers == 2.9.1
allennlp==1.0.0