File size: 8,517 Bytes
5743bce | 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 | {
"cells": [
{
"cell_type": "markdown",
"id": "0fc4c61a",
"metadata": {},
"source": [
"## Loading a model onto HF"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3c851cd5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: huggingface_hub in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (0.30.2)\n",
"Requirement already satisfied: filelock in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (3.15.4)\n",
"Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (2024.6.1)\n",
"Requirement already satisfied: packaging>=20.9 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (24.2)\n",
"Requirement already satisfied: pyyaml>=5.1 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (6.0.1)\n",
"Requirement already satisfied: requests in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (2.32.3)\n",
"Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (4.66.4)\n",
"Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from huggingface_hub) (4.12.2)\n",
"Requirement already satisfied: colorama in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from tqdm>=4.42.1->huggingface_hub) (0.4.6)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from requests->huggingface_hub) (3.3.2)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from requests->huggingface_hub) (3.7)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from requests->huggingface_hub) (2.0.7)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\ishan\\appdata\\local\\packages\\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\\localcache\\local-packages\\python311\\site-packages (from requests->huggingface_hub) (2024.7.4)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"[notice] A new release of pip is available: 24.3.1 -> 25.1.1\n",
"[notice] To update, run: C:\\Users\\ishan\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\python.exe -m pip install --upgrade pip\n"
]
}
],
"source": [
"# Install if you haven't already\n",
"!pip install huggingface_hub"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "85147dd3",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Consider using `hf_transfer` for faster uploads. This solution comes with some limitations. See https://huggingface.co/docs/huggingface_hub/hf_transfer for more details.\n",
"Traceback (most recent call last):\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\utils\\_http.py\", line 409, in hf_raise_for_status\n",
" response.raise_for_status()\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\requests\\models.py\", line 1024, in raise_for_status\n",
" raise HTTPError(http_error_msg, response=self)\n",
"requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/api/repos/create\n",
"\n",
"The above exception was the direct cause of the following exception:\n",
"\n",
"Traceback (most recent call last):\n",
" File \"<frozen runpy>\", line 198, in _run_module_as_main\n",
" File \"<frozen runpy>\", line 88, in _run_code\n",
" File \"c:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\Scripts\\huggingface-cli.exe\\__main__.py\", line 7, in <module>\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\commands\\huggingface_cli.py\", line 57, in main\n",
" service.run()\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\commands\\upload.py\", line 206, in run\n",
" print(self._upload())\n",
" ^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\commands\\upload.py\", line 267, in _upload\n",
" repo_id = self.api.create_repo(\n",
" ^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\utils\\_validators.py\", line 114, in _inner_fn\n",
" return fn(*args, **kwargs)\n",
" ^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\hf_api.py\", line 3722, in create_repo\n",
" raise err\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\hf_api.py\", line 3709, in create_repo\n",
" hf_raise_for_status(r)\n",
" File \"C:\\Users\\ishan\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\huggingface_hub\\utils\\_http.py\", line 473, in hf_raise_for_status\n",
" raise _format(HfHubHTTPError, message, response) from e\n",
"huggingface_hub.errors.HfHubHTTPError: 403 Forbidden: None.\n",
"Cannot access content at: https://huggingface.co/api/repos/create.\n",
"Make sure your token has the correct permissions.\n"
]
}
],
"source": [
"!huggingface-cli upload Ishanan/lemma-model . --repo-type model --token YOUR_HF_TOKEN_HERE"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "360e19b7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|