File size: 7,267 Bytes
278b41f |
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "db0fb324-5d25-4b3d-8fec-d1a44133c46b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: huggingface_hub in /opt/conda/lib/python3.10/site-packages (0.28.1)\n",
"Requirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (3.13.1)\n",
"Requirement already satisfied: fsspec>=2023.5.0 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2024.2.0)\n",
"Requirement already satisfied: packaging>=20.9 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (23.1)\n",
"Requirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (6.0.1)\n",
"Requirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2.31.0)\n",
"Requirement already satisfied: tqdm>=4.42.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.65.0)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.12.2)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2.0.4)\n",
"Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (3.4)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2.1.0)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2024.2.2)\n",
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"pip install huggingface_hub"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ccb7bd91-c4be-4493-99cc-e5e44816627b",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0721ad5149e9468b83e667feb6658365",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.sv…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from huggingface_hub import login\n",
"login()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "6d975db0-1bec-4bdf-84b2-0a5f6dbe8c44",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/workspace/CosyVoice\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.10/site-packages/IPython/core/magics/osm.py:417: UserWarning: using dhist requires you to install the `pickleshare` library.\n",
" self.shell.db['dhist'] = compress_dhist(dhist)[-100:]\n"
]
}
],
"source": [
"%cd .."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ad4e1d0-b5f9-4b5a-a5f4-b162554008dc",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 6,
"id": "4824c41d-4b54-4fed-bf30-526f0aac4619",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/lib/python3.10/site-packages/huggingface_hub/hf_api.py:9216: UserWarning: Warnings while validating metadata in README.md:\n",
"- empty or missing yaml metadata in repo card\n",
" warnings.warn(f\"Warnings while validating metadata in README.md:\\n{message}\")\n",
"It seems you are trying to upload a large folder at once. This might take some time and then fail if the folder is too large. For such cases, it is recommended to upload in smaller batches or to use `HfApi().upload_large_folder(...)`/`huggingface-cli upload-large-folder` instead. For more details, check out https://huggingface.co/docs/huggingface_hub/main/en/guides/upload#upload-a-large-folder.\n"
]
},
{
"data": {
"text/plain": [
"CommitInfo(commit_url='https://huggingface.co/kevinwang676/CosyVoice2/commit/b7d3b46ed7ed6d34f7e595fca3e4ed23d3db3f3d', commit_message='Upload folder using huggingface_hub', commit_description='', oid='b7d3b46ed7ed6d34f7e595fca3e4ed23d3db3f3d', pr_url=None, repo_url=RepoUrl('https://huggingface.co/kevinwang676/CosyVoice2', endpoint='https://huggingface.co', repo_type='model', repo_id='kevinwang676/CosyVoice2'), pr_revision=None, pr_num=None)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from huggingface_hub import HfApi\n",
"api = HfApi()\n",
"\n",
"api.upload_folder(\n",
" folder_path=\"\",\n",
" repo_id=\"kevinwang676/CosyVoice2\",\n",
" repo_type=\"model\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "be43697d-6064-4097-b3c4-3466a03ba19b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"CommitInfo(commit_url='https://huggingface.co/kevinwang676/CosyVoice2/commit/ecad1371e4e3b3a477f5cce458e415f4674ab8d3', commit_message='Upload folder using huggingface_hub', commit_description='', oid='ecad1371e4e3b3a477f5cce458e415f4674ab8d3', pr_url=None, repo_url=RepoUrl('https://huggingface.co/kevinwang676/CosyVoice2', endpoint='https://huggingface.co', repo_type='model', repo_id='kevinwang676/CosyVoice2'), pr_revision=None, pr_num=None)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from huggingface_hub import HfApi\n",
"api = HfApi()\n",
"\n",
"api.upload_folder(\n",
" folder_path=\"cosyvoice\",\n",
" repo_id=\"kevinwang676/CosyVoice2\",\n",
" repo_type=\"model\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4476e9ee-c00b-43fc-b2d0-dd4a0f6c76ed",
"metadata": {},
"outputs": [],
"source": [
"api.upload_large_folder(\n",
" repo_id=\"kevinwang676/CosyVoice2\",\n",
" repo_type=\"dataset\",\n",
" folder_path=\"/path/to/local/docmatix\",\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
}
|