Unable to load weights from pytorch checkpoint
Hello,
I recently cloned the model from your huggingface repo and wanted to test it. However, I could not load the model because of the following error:
OSError: Unable to load weights from pytorch checkpoint file for 'hf_models/gatortron-large/pytorch_model.bin' at 'hf_models/gatortron-large/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Here is the script I tried to run (same as the examples you provided on the model card):
import transformers
import torch
model_id = "/scratch/hexu/LLMs/hf_models/gatortron-large"
from transformers import AutoModel, AutoTokenizer, AutoConfig
tokenizer= AutoTokenizer.from_pretrained(model_id)
config=AutoConfig.from_pretrained(model_id)
mymodel=AutoModel.from_pretrained(model_id)
encoded_input=tokenizer("Bone scan: Negative for distant metastasis.", return_tensors="pt")
encoded_output = mymodel(**encoded_input)
print (encoded_output)
And here are the versions of the packages:
tensorflow 2.17.0
tokenizers 0.19.1
torch 2.2.2+cu118
transformers 4.43.0
Does anyone have any suggestions? Thanks in advance.