unable to load config file

#7
by DivyaKanniah - opened

hi,
i have tried to load the model and tokenizer , but unable to load the config and model

tokenizer = AutoTokenizer.from_pretrained("pszemraj/flan-t5-large-grammar-synthesis")
model = AutoModelForSeq2SeqLM.from_pretrained("pszemraj/flan-t5-large-grammar-synthesis")
corrector=pipeline('text2text-generation','pszemraj/flan-t5-large-grammar-synthesis',)

{"errorMessage": "Can't load config for 'pszemraj/flan-t5-large-grammar-synthesis'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'pszemraj/flan-t5-large-grammar-synthesis' is the correct path to a directory containing a config.json file"

Hi there,

I'm sorry to hear that you're having trouble loading the model and the tokeniser. One thing to keep in mind is that if you're going to load the model into the pipeline anyway, you don't really need to load it separately with AutoModelForSeq2SeqLM. You can try running the sample code provided directly, which should work fine.

from transformers import pipeline

corrector = pipeline(
              'text2text-generation',
              'pszemraj/flan-t5-large-grammar-synthesis',
              )
raw_text = 'i can has cheezburger'
results = corrector(raw_text)
print(results)

If you still want to load the model and tokenizer separately, please check that you have the correct path to the directory containing the config.json file. If you're still having problems, try downloading the model and tokenizer again:

import os

os.environ["HF_ENDPOINT"] = "https://huggingface.co"

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
from transformers import pipeline

tokenizer = AutoTokenizer.from_pretrained("pszemraj/flan-t5-large-grammar-synthesis")

model = AutoModelForSeq2SeqLM.from_pretrained(
    "pszemraj/flan-t5-large-grammar-synthesis"
)
corrector = pipeline(
    "text2text-generation",
    model=model,
    tokenizer=tokenizer,
)

Let me know if you have any further questions or problems!

Thanks for the response , it would be great if you add the packages versions as well , can i know versions used

i am using python 3.8 ,
sentence-transformers 2.1.0
transformers 4.15.0

Regarding the package versions used, I have tested my model on the latest version of transformers (4.26.1) with Python 3.8. While I can confirm that it works on this specific configuration, I cannot provide support for older package versions or guarantee that my model will work with them. I'm sorry for any inconvenience this may cause.

If you're having trouble running my model with your current configuration, I suggest you update your transformers package to the latest version (4.26.1) and try again. Also, please note that the version of sentence-transformers you mention (2.1.0) is not a dependency of my model, so I cannot comment on whether or not it will work with that specific version.

DivyaKanniah changed discussion status to closed
DivyaKanniah changed discussion status to open

Hi - let me know if you have issues still with the latest versions/colab notebook, otherwise I'll mark this as closed in a day or so!

closing this out

pszemraj changed discussion status to closed

Sign up or log in to comment