{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from huggingface_hub import HfApi, HfFolder, Repository\n", "\n", "repo_id = \"your_username/your_model_name\"\n", "repo_local_path = \"./path_to_your_model\"\n", "\n", "# Create the repository object and clone the repo\n", "repo = Repository(local_dir=repo_local_path, clone_from=repo_id)\n", "\n", "# Copy your model files to the repository\n", "model_files = [\"config.json\", \"pytorch_model.bin\", \"tokenizer_config.json\", \"vocab.json\"]\n", "for file in model_files:\n", " shutil.copy(file, repo_local_path)\n", "\n", "# Push the model files to the repository\n", "repo.push_to_hub(commit_message=\"Initial model upload\")\n" ] } ], "metadata": { "kernelspec": { "display_name": "chemistralpy310", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.14" } }, "nbformat": 4, "nbformat_minor": 2 }