Can't load tokenizer using from_pretrained, please update its configuration: not a string

#1
by gokul427 - opened

Getting this error in Inference API. Not sure if the format of text should be changed or any issue with code.

Hey there this model is quite obsolete and not updated since one year.you should look instead or more recent models 🤗

I know I'm late, but you can load from t5-base:
"""

from transformers import T5ForConditionalGeneration, T5TokenizerFast

tokenizer = T5TokenizerFast.from_pretrained("t5-base")
hfmodel = T5ForConditionalGeneration.from_pretrained("ThomasSimonini/t5-end2end-question-generation")

text = "The abolition of feudal privileges by the National Constituent Assembly on 4 August 1789 and the Declaration \nof the Rights of Man and of the Citizen (La Déclaration des Droits de l'Homme et du Citoyen), drafted by Lafayette \nwith the help of Thomas Jefferson and adopted on 26 August, paved the way to a Constitutional Monarchy \n(4 September 1791 – 21 September 1792). Despite these dramatic changes, life at the court continued, while the situation \nin Paris was becoming critical because of bread shortages in September. On 5 October 1789, a crowd from Paris descended upon Versailles \nand forced the royal family to move to the Tuileries Palace in Paris, where they lived under a form of house arrest under \nthe watch of Lafayette's Garde Nationale, while the Comte de Provence and his wife were allowed to reside in the \nPetit Luxembourg, where they remained until they went into exile on 20 June 1791."

def run_model(input_string, **generator_args):
generator_args = {
"max_length": 256,
"num_beams": 4,
"length_penalty": 1.5,
"no_repeat_ngram_size": 3,
"early_stopping": True,
}
input_string = "generate questions: " + input_string + " "
input_ids = tokenizer.encode(input_string, return_tensors="pt")
res = hfmodel.generate(input_ids, **generator_args)
output = tokenizer.batch_decode(res, skip_special_tokens=True)
output = [item.split("") for item in output]
return output

print(run_model(text))
""".
Seemed fine on my end.

Sign up or log in to comment