title: How to save the model and artifacts for later use - Hugginface Multilabel Classification Model
body: <p>I followed this awesome guide here <a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/BERT/Fine_tuning_BERT_(and_friends)_for_multi_label_text_classification.ipynb" rel="nofollow noreferrer">multilabel Classification with Bert</a></p>
  <p>and used my dataset and the results are very good.  I am having a hard time know trying to understand how to save the model I trainned and all the  artifacts needed to use my model later.</p>
  <p>I have saved the following files from all epochs in training process:</p>
  <pre><code>config.json
  optimizer.pt
  pytorch_model.bin
  rng_state.pth
  special_tokens_map.json
  tokenizer.json
  tokenizer_config.json
  trainer_state.json
  training_args.bin
  vocab.txt
  </code></pre>
  <p>I tried at the end of the tutorial:  <code>torch.save(trainer, 'my_model')</code> but I got this error msg:</p>
  <p><code>AttributeError: Can't pickle local object 'get_linear_schedule_with_warmup.&lt;locals&gt;.lr_lambda'</code></p>
  <p>Can someone kindly guide me how to save this model to later use?
  Thank you very much</p>