hooshvare / parsbert

πŸ€— ParsBERT: Transformer-based Model for Persian Language Understanding

Home Page:https://doi.org/10.1007/s11063-021-10528-4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Mary-NJ opened this issue Β· comments

i encounter this error due to use the bert model on data...
code have no error on colab, but in my system, it happens:
OSError: Unable to load weights from the PyTorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
for tokenizer and config, it is ok, but in case of using a model it takes this and breaks out:((
is there any body to help?

Could you please share the files in your fine-tuned model directory?

line 477, in load_state_dict
raise OSError(
OSError: Unable to load weights from pytorch checkpoint file for '.cache\huggingface\transformers\4a74c6c9128ba518e61fbdf559d03e64b6bd0ad6db588419dfd865ace535942a.a48b7b4437be34e24274c9cf6cf57e2424d3f1eec537ec03b905e6f01d19ed77' at 'DicytPath/.cache\huggingface\transformers\4a74c6c9128ba518e61fbdf559d03e64b6bd0ad6db588419dfd865ace535942a.a48b7b4437be34e24274c9cf6cf57e2424d3f1eec537ec03b905e6f01d19ed77'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
Hey Please can you help me to solve this problem

Those who are new to this issue I just figured it out and save your time πŸ˜œπŸ˜€

What is this error about?
==> When you run the model for the first time it downloads some files { pytorch_model.bin } and if your internet is broken accidentally between processes it will continue running the pipeline file without completely downloading that pytorch_model.bin file so it will raise this issue.

Steps :
1 ] Go to C:// Users / UserName / .cache
2 ] Delete .cache folder
3 ] And Done Just Run The Model Once Again......