Hi everybody,
After reading the docs I still don’t really understand how should I load my saved model properly.
I fine tuned a CamembertForSequenceClassification.from_pretrained model with some data, the results was good so I saved it using save_pretrained(model_path). Now I would like to use this model to do inference… I use these lines of code:
config = AutoConfig.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSequenceClassification.from_config(config)
I now have several interogation:
- If I tokenize a new sequence with tokenizer.encode_plus(new_seq), it doesn’t tokenize the sentence the way it did when I previously saved the model. I must precise all the params (max_length…) to retrieve what I want. Is that normal?
- If I load my saved model without using AutoModelForSequenceClassification but with AutoModel the model do not load a classification layer however I saved my model using this last layer. Is that also normal?
So I’m wondering how can I be sure that I load the exact same model with all the weights and params that I saved previously.
Thanks for everything!