Upload Model To Huggingface

backup
git
huggingface
model
network
stub
sync
This article provides a step-by-step guide on how to upload a model to Hugging Face’s Hub using code. It includes a link for detailed instructions and demonstrates the process with the Camembert language model, utilizing AutoModelForMaskedLM and AutoTokenizer from Transformers library. The model and tokenizer are then pushed to the Hub under the name ‘dummy-model’.
Published

May 29, 2022


via code:

https://zhuanlan.zhihu.com/p/390826470

from transformers import AutoModelForMaskedLM, AutoTokenizer

checkpoint = “camembert-base”

model = AutoModelForMaskedLM.from_pretrained(checkpoint)

tokenizer = AutoTokenizer.from_pretrained(checkpoint)

model.push_to_hub(“dummy-model”)

tokenizer.push_to_hub(“dummy-model”)

config.push_to_hub(“”)