File size: 2,735 Bytes
bd7ffdb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "caa74bef",
"metadata": {},
"outputs": [],
"source": [
"!pip install huggingface_hub --upgrade\n",
"\n",
"!pip install ipywidgets --upgrade"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e10d4e70-b7c5-476b-916c-14cce7e436e5",
"metadata": {},
"outputs": [],
"source": [
"from huggingface_hub import login\n",
"login()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0502703b-8b44-4e58-af2c-82f67d713548",
"metadata": {},
"outputs": [],
"source": [
"from huggingface_hub import HfApi\n",
"api = HfApi()\n",
"api.upload_file(\n",
" path_or_fileobj=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion/model_name.safetensors\",\n",
" path_in_repo=\"model_name.safetensors\",\n",
" repo_id=\"YourUserName/reponame\",\n",
" repo_type=\"model\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3be9367c-a04d-4d05-83ad-c8504e0383b4",
"metadata": {},
"outputs": [],
"source": [
"from huggingface_hub import HfApi\n",
"api = HfApi()\n",
"api.upload_folder(\n",
" folder_path=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion\",\n",
" repo_id=\"YourUserName/reponame\",\n",
" repo_type=\"model\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6fc96104",
"metadata": {},
"outputs": [],
"source": [
"from huggingface_hub import HfApi\n",
"from huggingface_hub import get_collection, delete_collection_item\n",
"from huggingface_hub import upload_file\n",
"from huggingface_hub import (\n",
" HfFolder,\n",
" ModelCard,\n",
" ModelCardData,\n",
" create_repo,\n",
" hf_hub_download,\n",
" upload_folder,\n",
" whoami,\n",
")\n",
"api = HfApi()\n",
"upload_folder(\n",
" folder_path=r\"/home/Ubuntu/apps/stable-diffusion-webui/models/Stable-diffusion\",\n",
" repo_id=\"YourUserName/reponame\",\n",
" repo_type=\"model\",\n",
" multi_commits=True,\n",
" multi_commits_verbose=True,\n",
")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|