I have trained a model, how do I load it up?
Hi, I have managed to train a model using trainer. I evaluated some results whilst the model was still on the disk using ‘trainer.predict()’. I then usedtrainer.save_model()and now want to load it up for usage again. By saving, I got three files in my drive;pytorch_model.binconfig.jsontraining_args.jsonI am assuming the model is pytorch_model.bin but I am unsure how do I load it up? I trained a classification model so do I call again;model = AutoModelForSequenceClassification.from_pretrained(**filepath**, 
                                                           num_labels=5,
                                                           output_attentions = False, #
                                                           output_hidden_states = False
                                                           )wherefilepathis the path to pytorch_model.bin? do I then call again a trainer and send the model to that to again use trainer.predict() for new predictions?
2021-03-08T07:13:40Z
You can do it in pytorch or tf like you would with any other model, or you can usePipelines — transformers 4.3.0 documentation
2021-03-08T09:06:03Z
Thank you, just to double check, would it be like this (Im most unsure about how if this is how we call the model);pipeline('sentiment-analysis', model='some_file_path/pytorch_model.bin',
 `tokenizer=tokenizer')
2021-03-08T14:44:39Z
Looks good to me, if sentiment-analysis is what you want to do.