0
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Hi @SKSingh, welcome to the site. You should add more details to the question, e.g. what Transformer library are you using (link to it)? what do you mean by "load" in "load the model in docker container/environment" (e.g. offer it through an API, use it in the command line)? $\endgroup$ – noe Apr 6 at 13:03
  • $\begingroup$ Updated the question a bit. Let me know if I need to any more infornation $\endgroup$ – SK Singh Apr 6 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.