Save and Load Simple Transformer Model
I have trained Text classifier using simpleTranformer.ai I am struggling to save and load the model in docker container. Please let me know how can I save the trained model and then load it into different environment smoothly. I am using this library to : https://simpletransformers.ai/ to train a text model using these commands
model = ClassificationModel('xlmroberta', 'xlm-roberta-base',use_cuda=cuda_available, num_labels=78, args={'learning_rate':1e-5, 'num_train_epochs': 1,'train_batch_size':256,'eval_batch_size':1048, 'n_gpu':4, 'reprocess_input_data': True,
'overwrite_output_dir':True, 'overwrite_output_dir': True})
model.train_model(train_df)
I am saving the trained model using pytorch function:
torch.save(model, 'classifier')
But its showing error of some missing files when I tried to load this model from different virtual machine. So, I am looking for best alternative to save and load the simpleTransformer model.
Topic transformer torch python
Category Data Science