| # Upload to Hugging Face Hub | |
| To upload your model to the Hugging Face Hub, you can use the Hugging Face CLI: | |
| ## 1. Install the Hugging Face Hub CLI | |
| ```bash | |
| pip install huggingface_hub | |
| ``` | |
| ## 2. Login to Hugging Face | |
| ```bash | |
| huggingface-cli login | |
| ``` | |
| ## 3. Create a new repository | |
| Go to https://huggingface.co/new and create a new model repository. | |
| ## 4. Upload your model | |
| ```bash | |
| cd ./published_model/hf_model | |
| git init | |
| git add . | |
| git commit -m "Initial model upload" | |
| git remote add origin https://huggingface.co/PurelyUnfunctionalAI/GibberishGPT | |
| git push -u origin main | |
| ``` | |
| Alternatively, you can use the Python API: | |
| ```python | |
| from huggingface_hub import HfApi | |
| api = HfApi() | |
| # Login to Hugging Face | |
| api.login() | |
| # Upload model files | |
| api.create_repo(repo_id="PurelyUnfunctionalAI/GibberishGPT", repo_type="model", exist_ok=True) | |
| api.upload_folder( | |
| folder_path="./published_model/hf_model", | |
| repo_id="PurelyUnfunctionalAI/GibberishGPT", | |
| commit_message="Upload model" | |
| ) | |
| ``` | |