!pip install datasets evaluate transformers[sentencepiece] !apt install git-lfs !git config --global user.email "you@example.com" !git config --global user.name "Your Name" from huggingface_hub import notebook_login notebook_login() from huggingface_hub import notebook_login notebook_login() from transformers import TrainingArguments training_args = TrainingArguments( "bert-finetuned-mrpc", save_strategy="epoch", push_to_hub=True ) 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") tokenizer.push_to_hub("dummy-model", organization="huggingface") tokenizer.push_to_hub("dummy-model", organization="huggingface", use_auth_token="") from huggingface_hub import ( # User management login, logout, whoami, # Repository creation and management create_repo, delete_repo, update_repo_visibility, # And some methods to retrieve/change information about the content list_models, list_datasets, list_metrics, list_repo_files, upload_file, delete_file, ) from huggingface_hub import create_repo create_repo("dummy-model") from huggingface_hub import create_repo create_repo("dummy-model", organization="huggingface") from huggingface_hub import upload_file upload_file( "/config.json", path_in_repo="config.json", repo_id="/dummy-model", ) from huggingface_hub import Repository repo = Repository("", clone_from="/dummy-model") repo.git_pull() repo.git_add() repo.git_commit() repo.git_push() repo.git_tag() repo.git_pull() model.save_pretrained("") tokenizer.save_pretrained("") repo.git_add() repo.git_commit("Add model and tokenizer files") repo.git_push() from transformers import AutoModelForMaskedLM, AutoTokenizer checkpoint = "camembert-base" model = AutoModelForMaskedLM.from_pretrained(checkpoint) tokenizer = AutoTokenizer.from_pretrained(checkpoint) # Do whatever with the model, train it, fine-tune it... model.save_pretrained("") tokenizer.save_pretrained("")