arthrod commited on
Commit
381b4bd
1 Parent(s): b4b87c4

Delete Untitled.ipynb

Browse files
Files changed (1) hide show
  1. Untitled.ipynb +0 -734
Untitled.ipynb DELETED
@@ -1,734 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "id": "64361b9e-39fe-4777-9887-68712aa1098b",
7
- "metadata": {},
8
- "outputs": [],
9
- "source": [
10
- "#Model Commit"
11
- ]
12
- },
13
- {
14
- "cell_type": "code",
15
- "execution_count": 3,
16
- "id": "9483d5c4-b8c5-48f8-b86d-bde850edc532",
17
- "metadata": {},
18
- "outputs": [
19
- {
20
- "name": "stdout",
21
- "output_type": "stream",
22
- "text": [
23
- "Requirement already satisfied: huggingface_hub in /opt/conda/lib/python3.10/site-packages (0.21.3)\n",
24
- "Collecting python-dotenv\n",
25
- " Downloading python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)\n",
26
- "Requirement already satisfied: filelock in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (3.13.1)\n",
27
- "Requirement already satisfied: fsspec>=2023.5.0 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2023.12.2)\n",
28
- "Requirement already satisfied: requests in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (2.31.0)\n",
29
- "Requirement already satisfied: tqdm>=4.42.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.65.0)\n",
30
- "Requirement already satisfied: pyyaml>=5.1 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (6.0.1)\n",
31
- "Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (4.9.0)\n",
32
- "Requirement already satisfied: packaging>=20.9 in /opt/conda/lib/python3.10/site-packages (from huggingface_hub) (23.1)\n",
33
- "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2.0.4)\n",
34
- "Requirement already satisfied: idna<4,>=2.5 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (3.4)\n",
35
- "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (1.26.18)\n",
36
- "Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.10/site-packages (from requests->huggingface_hub) (2023.11.17)\n",
37
- "Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)\n",
38
- "Installing collected packages: python-dotenv\n",
39
- "Successfully installed python-dotenv-1.0.1\n",
40
- "\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",
41
- "\u001b[0m"
42
- ]
43
- }
44
- ],
45
- "source": [
46
- "!pip install huggingface_hub python-dotenv"
47
- ]
48
- },
49
- {
50
- "cell_type": "code",
51
- "execution_count": 4,
52
- "id": "93c881e9-1081-4ab8-883e-c0bd8abb241e",
53
- "metadata": {},
54
- "outputs": [
55
- {
56
- "name": "stdout",
57
- "output_type": "stream",
58
- "text": [
59
- "Token has not been saved to git credential helper. Pass `add_to_git_credential=True` if you want to set the git credential as well.\n",
60
- "Token is valid (permission: write).\n",
61
- "Your token has been saved to /root/.cache/huggingface/token\n",
62
- "Login successful\n"
63
- ]
64
- }
65
- ],
66
- "source": [
67
- "from dotenv import load_dotenv\n",
68
- "import os\n",
69
- "from huggingface_hub import login, hf_hub_download\n",
70
- "\n",
71
- "# Load environment variables from .env file\n",
72
- "load_dotenv()\n",
73
- "\n",
74
- "# Retrieve the Hugging Face token from the environment variable\n",
75
- "hf_token = os.getenv(\"HF_TOKEN\")\n",
76
- "\n",
77
- "# Ensure the token is present\n",
78
- "if not hf_token:\n",
79
- " raise ValueError(\"Hugging Face token not found. Make sure your .env file is configured correctly and HF_TOKEN is set.\")\n",
80
- "\n",
81
- "# Authenticate with Hugging Face using the token\n",
82
- "login(token=hf_token)"
83
- ]
84
- },
85
- {
86
- "cell_type": "code",
87
- "execution_count": 7,
88
- "id": "6c7c4ca0-31fe-4dd5-ae42-136ddf947983",
89
- "metadata": {},
90
- "outputs": [
91
- {
92
- "name": "stdout",
93
- "output_type": "stream",
94
- "text": [
95
- "Collecting package metadata (current_repodata.json): done\n",
96
- "Solving environment: done\n",
97
- "\n",
98
- "\n",
99
- "==> WARNING: A newer version of conda exists. <==\n",
100
- " current version: 23.9.0\n",
101
- " latest version: 24.1.2\n",
102
- "\n",
103
- "Please update conda by running\n",
104
- "\n",
105
- " $ conda update -n base -c defaults conda\n",
106
- "\n",
107
- "Or to minimize the number of packages updated during conda update use\n",
108
- "\n",
109
- " conda install conda=24.1.2\n",
110
- "\n",
111
- "\n",
112
- "\n",
113
- "## Package Plan ##\n",
114
- "\n",
115
- " environment location: /opt/conda\n",
116
- "\n",
117
- " added / updated specs:\n",
118
- " - git\n",
119
- "\n",
120
- "\n",
121
- "The following packages will be downloaded:\n",
122
- "\n",
123
- " package | build\n",
124
- " ---------------------------|-----------------\n",
125
- " ca-certificates-2023.08.22 | h06a4308_0 130 KB anaconda\n",
126
- " certifi-2023.11.17 | py310h06a4308_0 159 KB anaconda\n",
127
- " curl-8.4.0 | hdbd6064_0 90 KB anaconda\n",
128
- " gdbm-1.18 | hd4cb3f1_4 193 KB anaconda\n",
129
- " gettext-0.21.0 | h39681ba_1 3.4 MB anaconda\n",
130
- " git-2.40.1 | pl5340h36fbf9e_1 9.9 MB\n",
131
- " libcurl-8.4.0 | h251f7ec_0 388 KB anaconda\n",
132
- " openssl-3.0.12 | h7f8727e_0 5.2 MB anaconda\n",
133
- " perl-5.34.0 | h5eee18b_2 13.3 MB anaconda\n",
134
- " ------------------------------------------------------------\n",
135
- " Total: 32.8 MB\n",
136
- "\n",
137
- "The following NEW packages will be INSTALLED:\n",
138
- "\n",
139
- " curl anaconda/linux-64::curl-8.4.0-hdbd6064_0 \n",
140
- " gdbm anaconda/linux-64::gdbm-1.18-hd4cb3f1_4 \n",
141
- " gettext anaconda/linux-64::gettext-0.21.0-h39681ba_1 \n",
142
- " git pkgs/main/linux-64::git-2.40.1-pl5340h36fbf9e_1 \n",
143
- " perl anaconda/linux-64::perl-5.34.0-h5eee18b_2 \n",
144
- "\n",
145
- "The following packages will be SUPERSEDED by a higher-priority channel:\n",
146
- "\n",
147
- " ca-certificates pkgs/main::ca-certificates-2023.12.12~ --> anaconda::ca-certificates-2023.08.22-h06a4308_0 \n",
148
- " certifi pkgs/main --> anaconda \n",
149
- " libcurl pkgs/main::libcurl-8.4.0-h251f7ec_1 --> anaconda::libcurl-8.4.0-h251f7ec_0 \n",
150
- " openssl pkgs/main --> anaconda \n",
151
- "\n",
152
- "\n",
153
- "\n",
154
- "Downloading and Extracting Packages:\n",
155
- "libcurl-8.4.0 | 388 KB | | 0% \n",
156
- "perl-5.34.0 | 13.3 MB | | 0% \u001b[A\n",
157
- "\n",
158
- "git-2.40.1 | 9.9 MB | | 0% \u001b[A\u001b[A\n",
159
- "\n",
160
- "\n",
161
- "certifi-2023.11.17 | 159 KB | | 0% \u001b[A\u001b[A\u001b[A\n",
162
- "\n",
163
- "\n",
164
- "\n",
165
- "openssl-3.0.12 | 5.2 MB | | 0% \u001b[A\u001b[A\u001b[A\u001b[A\n",
166
- "\n",
167
- "\n",
168
- "\n",
169
- "\n",
170
- "curl-8.4.0 | 90 KB | | 0% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
171
- "\n",
172
- "\n",
173
- "\n",
174
- "\n",
175
- "\n",
176
- "ca-certificates-2023 | 130 KB | | 0% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
177
- "\n",
178
- "\n",
179
- "\n",
180
- "\n",
181
- "\n",
182
- "\n",
183
- "gettext-0.21.0 | 3.4 MB | | 0% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
184
- "\n",
185
- "\n",
186
- "\n",
187
- "\n",
188
- "\n",
189
- "\n",
190
- "\n",
191
- "gdbm-1.18 | 193 KB | | 0% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
192
- "\n",
193
- "libcurl-8.4.0 | 388 KB | #5 | 4% \u001b[A\u001b[A\n",
194
- "\n",
195
- "\n",
196
- "certifi-2023.11.17 | 159 KB | ###7 | 10% \u001b[A\u001b[A\u001b[A\n",
197
- "\n",
198
- "\n",
199
- "\n",
200
- "openssl-3.0.12 | 5.2 MB | 1 | 0% \u001b[A\u001b[A\u001b[A\u001b[A\n",
201
- "perl-5.34.0 | 13.3 MB | | 0% \u001b[A\n",
202
- "\n",
203
- "git-2.40.1 | 9.9 MB | ##########6 | 29% \u001b[A\u001b[A\n",
204
- "\n",
205
- "\n",
206
- "\n",
207
- "\n",
208
- "\n",
209
- "ca-certificates-2023 | 130 KB | ####5 | 12% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
210
- "\n",
211
- "\n",
212
- "\n",
213
- "openssl-3.0.12 | 5.2 MB | #####7 | 16% \u001b[A\u001b[A\u001b[A\u001b[A\n",
214
- "\n",
215
- "\n",
216
- "\n",
217
- "\n",
218
- "curl-8.4.0 | 90 KB | ######6 | 18% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
219
- "perl-5.34.0 | 13.3 MB | #3 | 4% \u001b[A\n",
220
- "\n",
221
- "\n",
222
- "\n",
223
- "\n",
224
- "\n",
225
- "ca-certificates-2023 | 130 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
226
- "\n",
227
- "libcurl-8.4.0 | 388 KB | ##################################### | 100% \u001b[A\u001b[A\n",
228
- "\n",
229
- "\n",
230
- "certifi-2023.11.17 | 159 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\n",
231
- "\n",
232
- "\n",
233
- "certifi-2023.11.17 | 159 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\n",
234
- "\n",
235
- "\n",
236
- "\n",
237
- "\n",
238
- "\n",
239
- "\n",
240
- "gettext-0.21.0 | 3.4 MB | 1 | 0% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
241
- "\n",
242
- "\n",
243
- "\n",
244
- "\n",
245
- "curl-8.4.0 | 90 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
246
- "\n",
247
- "\n",
248
- "\n",
249
- "openssl-3.0.12 | 5.2 MB | #######################7 | 64% \u001b[A\u001b[A\u001b[A\u001b[A\n",
250
- "\n",
251
- "\n",
252
- "\n",
253
- "\n",
254
- "\n",
255
- "\n",
256
- "\n",
257
- "gdbm-1.18 | 193 KB | ### | 8% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
258
- "perl-5.34.0 | 13.3 MB | ####6 | 12% \u001b[A\n",
259
- "perl-5.34.0 | 13.3 MB | ########6 | 23% \u001b[A\n",
260
- "perl-5.34.0 | 13.3 MB | ###############6 | 42% \u001b[A\n",
261
- "\n",
262
- "\n",
263
- "\n",
264
- "\n",
265
- "\n",
266
- "\n",
267
- "\n",
268
- "gdbm-1.18 | 193 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
269
- "\n",
270
- "\n",
271
- "\n",
272
- "\n",
273
- "\n",
274
- "\n",
275
- "\n",
276
- "gdbm-1.18 | 193 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
277
- "perl-5.34.0 | 13.3 MB | ########################3 | 66% \u001b[A\n",
278
- "perl-5.34.0 | 13.3 MB | ##############################8 | 83% \u001b[A\n",
279
- "\n",
280
- "git-2.40.1 | 9.9 MB | ##################################### | 100% \u001b[A\u001b[A\n",
281
- "\n",
282
- "git-2.40.1 | 9.9 MB | ##################################### | 100% \u001b[A\u001b[A\n",
283
- "\n",
284
- "\n",
285
- "\n",
286
- "\n",
287
- "\n",
288
- "\n",
289
- "gettext-0.21.0 | 3.4 MB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
290
- "\n",
291
- "\n",
292
- "\n",
293
- "\n",
294
- "\n",
295
- "\n",
296
- "gettext-0.21.0 | 3.4 MB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
297
- "\n",
298
- "\n",
299
- "\n",
300
- "openssl-3.0.12 | 5.2 MB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\n",
301
- "\n",
302
- "\n",
303
- "\n",
304
- "openssl-3.0.12 | 5.2 MB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\u001b[A\n",
305
- "perl-5.34.0 | 13.3 MB | ##################################### | 100% \u001b[A\n",
306
- " \u001b[A\n",
307
- " \u001b[A\n",
308
- "\n",
309
- " \u001b[A\u001b[A\n",
310
- "\n",
311
- "\n",
312
- " \u001b[A\u001b[A\u001b[A\n",
313
- "\n",
314
- "\n",
315
- "\n",
316
- " \u001b[A\u001b[A\u001b[A\u001b[A\n",
317
- "\n",
318
- "\n",
319
- "\n",
320
- "\n",
321
- " \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
322
- "\n",
323
- "\n",
324
- "\n",
325
- "\n",
326
- "\n",
327
- " \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
328
- "\n",
329
- "\n",
330
- "\n",
331
- "\n",
332
- "\n",
333
- "\n",
334
- " \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
335
- "\n",
336
- "\n",
337
- "\n",
338
- "\n",
339
- "\n",
340
- "\n",
341
- "\n",
342
- " \u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\u001b[A\n",
343
- "Preparing transaction: done\n",
344
- "Verifying transaction: done\n",
345
- "Executing transaction: done\n",
346
- "Collecting package metadata (current_repodata.json): / WARNING conda.models.version:get_matcher(556): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1.*, but conda is ignoring the .* and treating it as 1.7.1\n",
347
- "done\n",
348
- "Solving environment: done\n",
349
- "\n",
350
- "\n",
351
- "==> WARNING: A newer version of conda exists. <==\n",
352
- " current version: 23.9.0\n",
353
- " latest version: 24.1.2\n",
354
- "\n",
355
- "Please update conda by running\n",
356
- "\n",
357
- " $ conda update -n base -c defaults conda\n",
358
- "\n",
359
- "Or to minimize the number of packages updated during conda update use\n",
360
- "\n",
361
- " conda install conda=24.1.2\n",
362
- "\n",
363
- "\n",
364
- "\n",
365
- "## Package Plan ##\n",
366
- "\n",
367
- " environment location: /opt/conda\n",
368
- "\n",
369
- " added / updated specs:\n",
370
- " - git-lfs\n",
371
- "\n",
372
- "\n",
373
- "The following packages will be downloaded:\n",
374
- "\n",
375
- " package | build\n",
376
- " ---------------------------|-----------------\n",
377
- " ca-certificates-2024.2.2 | hbcca054_0 152 KB conda-forge\n",
378
- " certifi-2024.2.2 | pyhd8ed1ab_0 157 KB conda-forge\n",
379
- " git-lfs-3.4.1 | ha770c72_0 3.6 MB conda-forge\n",
380
- " openssl-3.0.13 | h7f8727e_0 5.2 MB\n",
381
- " ------------------------------------------------------------\n",
382
- " Total: 9.1 MB\n",
383
- "\n",
384
- "The following NEW packages will be INSTALLED:\n",
385
- "\n",
386
- " git-lfs conda-forge/linux-64::git-lfs-3.4.1-ha770c72_0 \n",
387
- "\n",
388
- "The following packages will be UPDATED:\n",
389
- "\n",
390
- " ca-certificates anaconda::ca-certificates-2023.08.22-~ --> conda-forge::ca-certificates-2024.2.2-hbcca054_0 \n",
391
- " certifi anaconda/linux-64::certifi-2023.11.17~ --> conda-forge/noarch::certifi-2024.2.2-pyhd8ed1ab_0 \n",
392
- " openssl anaconda::openssl-3.0.12-h7f8727e_0 --> pkgs/main::openssl-3.0.13-h7f8727e_0 \n",
393
- "\n",
394
- "\n",
395
- "\n",
396
- "Downloading and Extracting Packages:\n",
397
- "certifi-2024.2.2 | 157 KB | | 0% \n",
398
- "git-lfs-3.4.1 | 3.6 MB | | 0% \u001b[A\n",
399
- "\n",
400
- "openssl-3.0.13 | 5.2 MB | | 0% \u001b[A\u001b[A\n",
401
- "\n",
402
- "\n",
403
- "ca-certificates-2024 | 152 KB | | 0% \u001b[A\u001b[A\u001b[A\n",
404
- "\n",
405
- "certifi-2024.2.2 | 157 KB | ###7 | 10% \u001b[A\u001b[A\n",
406
- "\n",
407
- "\n",
408
- "ca-certificates-2024 | 152 KB | ###9 | 11% \u001b[A\u001b[A\u001b[A\n",
409
- "git-lfs-3.4.1 | 3.6 MB | 1 | 0% \u001b[A\n",
410
- "\n",
411
- "\n",
412
- "certifi-2024.2.2 | 157 KB | ##################################### | 100% \u001b[A\u001b[A\u001b[A\n",
413
- "\n",
414
- "openssl-3.0.13 | 5.2 MB | ################ | 43% \u001b[A\u001b[A\n",
415
- "git-lfs-3.4.1 | 3.6 MB | ##############5 | 39% \u001b[A\n",
416
- "git-lfs-3.4.1 | 3.6 MB | ##################################### | 100% \u001b[A\n",
417
- "git-lfs-3.4.1 | 3.6 MB | ##################################### | 100% \u001b[A\n",
418
- "\n",
419
- "openssl-3.0.13 | 5.2 MB | ##################################### | 100% \u001b[A\u001b[A\n",
420
- "\n",
421
- " \u001b[A\u001b[A\n",
422
- " \u001b[A\n",
423
- "\n",
424
- " \u001b[A\u001b[A\n",
425
- "\n",
426
- "\n",
427
- " \u001b[A\u001b[A\u001b[A\n",
428
- "Preparing transaction: done\n",
429
- "Verifying transaction: done\n",
430
- "Executing transaction: done\n",
431
- "Git LFS initialized.\n",
432
- "Installation completed.\n"
433
- ]
434
- }
435
- ],
436
- "source": [
437
- "import sys\n",
438
- "\n",
439
- "# Install git\n",
440
- "!conda install -c anaconda git -y\n",
441
- "\n",
442
- "# Install git-lfs\n",
443
- "!conda install -c conda-forge git-lfs -y\n",
444
- "\n",
445
- "# Set up git-lfs (you only need to do this once)\n",
446
- "!git lfs install\n",
447
- "\n",
448
- "print(\"Installation completed.\")"
449
- ]
450
- },
451
- {
452
- "cell_type": "code",
453
- "execution_count": 8,
454
- "id": "785e2b01-4046-4aac-b72b-3918ab723414",
455
- "metadata": {
456
- "scrolled": true
457
- },
458
- "outputs": [
459
- {
460
- "name": "stderr",
461
- "output_type": "stream",
462
- "text": [
463
- "/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py:131: FutureWarning: 'Repository' (from 'huggingface_hub.repository') is deprecated and will be removed from version '1.0'. Please prefer the http-based alternatives instead. Given its large adoption in legacy code, the complete removal is only planned on next major release.\n",
464
- "For more details, please read https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http.\n",
465
- " warnings.warn(warning_message, FutureWarning)\n"
466
- ]
467
- },
468
- {
469
- "ename": "ValueError",
470
- "evalue": "If not specifying `clone_from`, you need to pass Repository a valid git clone.",
471
- "output_type": "error",
472
- "traceback": [
473
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
474
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
475
- "Cell \u001b[0;32mIn[8], line 33\u001b[0m\n\u001b[1;32m 31\u001b[0m repo \u001b[38;5;241m=\u001b[39m Repository(local_dir\u001b[38;5;241m=\u001b[39mrepo_local_path, clone_from\u001b[38;5;241m=\u001b[39mrepo_url, use_auth_token\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m 32\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 33\u001b[0m repo \u001b[38;5;241m=\u001b[39m \u001b[43mRepository\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlocal_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrepo_local_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43muse_auth_token\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 34\u001b[0m repo\u001b[38;5;241m.\u001b[39mgit_pull()\n\u001b[1;32m 36\u001b[0m \u001b[38;5;66;03m# Copy files from your model directory to the cloned repository\u001b[39;00m\n",
476
- "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:118\u001b[0m, in \u001b[0;36mvalidate_hf_hub_args.<locals>._inner_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m check_use_auth_token:\n\u001b[1;32m 116\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m smoothly_deprecate_use_auth_token(fn_name\u001b[38;5;241m=\u001b[39mfn\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m, has_token\u001b[38;5;241m=\u001b[39mhas_token, kwargs\u001b[38;5;241m=\u001b[39mkwargs)\n\u001b[0;32m--> 118\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
477
- "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py:132\u001b[0m, in \u001b[0;36m_deprecate_method.<locals>._inner_deprecate_method.<locals>.inner_f\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 130\u001b[0m warning_message \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m message\n\u001b[1;32m 131\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(warning_message, \u001b[38;5;167;01mFutureWarning\u001b[39;00m)\n\u001b[0;32m--> 132\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mf\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
478
- "File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/huggingface_hub/repository.py:538\u001b[0m, in \u001b[0;36mRepository.__init__\u001b[0;34m(self, local_dir, clone_from, repo_type, token, git_user, git_email, revision, skip_lfs_files, client)\u001b[0m\n\u001b[1;32m 536\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m[Repository] is a valid git repo\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 537\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 538\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIf not specifying `clone_from`, you need to pass Repository a valid git clone.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 540\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhuggingface_token \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m (git_email \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m git_user \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m 541\u001b[0m user \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclient\u001b[38;5;241m.\u001b[39mwhoami(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhuggingface_token)\n",
479
- "\u001b[0;31mValueError\u001b[0m: If not specifying `clone_from`, you need to pass Repository a valid git clone."
480
- ]
481
- }
482
- ],
483
- "source": [
484
- "from huggingface_hub import HfApi, HfFolder, Repository\n",
485
- "import os\n",
486
- "\n",
487
- "# Define the path to your model and the name of the Hugging Face repository\n",
488
- "local_model_directory = \"./workspace/outputs/NousResearch/Nous-Hermes-2-Mistral-7B-DPO/a83a8c0d-5838-47ac-ba15-69da87e94619/epoch_3/step_final/\"\n",
489
- "repo_name = \"clau_creat\"\n",
490
- "username = \"arthrod\" # Replace with your Hugging Face username\n",
491
- "repo_id = f\"{username}/{repo_name}\"\n",
492
- "\n",
493
- "# Authenticate with Hugging Face\n",
494
- "#token = HfFolder.get_token()\n",
495
- "#if token is None:\n",
496
- "# raise ValueError(\"You must be logged in to Hugging Face. Use `huggingface-cli login`.\")\n",
497
- "\n",
498
- "# Initialize the HfApi object\n",
499
- "api = HfApi()\n",
500
- "\n",
501
- "# Check if the repository exists, if not, create it\n",
502
- "try:\n",
503
- " api.repo_info(repo_id=repo_id)\n",
504
- "except Exception as e:\n",
505
- " print(f\"Repository {repo_id} does not exist. Creating it...\")\n",
506
- " api.create_repo(token=token, name=repo_name, organization=username, private=False) # Set private=True for a private repository\n",
507
- "\n",
508
- "# Clone the repository (if necessary) and copy your model files into it\n",
509
- "repo_url = f\"https://huggingface.co/{repo_id}\"\n",
510
- "repo_local_path = os.path.join(os.getcwd(), repo_name)\n",
511
- "\n",
512
- "# If the repo directory doesn't exist, clone it. Otherwise, just pull the latest changes\n",
513
- "if not os.path.isdir(repo_local_path):\n",
514
- " repo = Repository(local_dir=repo_local_path, clone_from=repo_url, use_auth_token=True)\n",
515
- "else:\n",
516
- " repo = Repository(local_dir=repo_local_path, use_auth_token=True)\n",
517
- " repo.git_pull()\n",
518
- "\n",
519
- "# Copy files from your model directory to the cloned repository\n",
520
- "for file_name in os.listdir(local_model_directory):\n",
521
- " src_file_path = os.path.join(local_model_directory, file_name)\n",
522
- " dst_file_path = os.path.join(repo_local_path, file_name)\n",
523
- " if os.path.isfile(src_file_path):\n",
524
- " os.replace(src_file_path, dst_file_path)\n",
525
- "\n",
526
- "# Commit and push the changes to the repository\n",
527
- "repo.git_add(auto_lfs_track=True)\n",
528
- "repo.git_commit(\"Upload model to Hugging Face Hub\")\n",
529
- "repo.git_push()\n",
530
- "\n",
531
- "print(f\"Model successfully uploaded to: https://huggingface.co/{repo_id}\")"
532
- ]
533
- },
534
- {
535
- "cell_type": "code",
536
- "execution_count": 14,
537
- "id": "41eb533d-7d4b-45a6-ae1a-e6cab2275431",
538
- "metadata": {},
539
- "outputs": [
540
- {
541
- "name": "stdout",
542
- "output_type": "stream",
543
- "text": [
544
- "Collecting pickleshare\n",
545
- " Downloading pickleshare-0.7.5-py2.py3-none-any.whl.metadata (1.5 kB)\n",
546
- "Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)\n",
547
- "Installing collected packages: pickleshare\n",
548
- "Successfully installed pickleshare-0.7.5\n",
549
- "\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",
550
- "\u001b[0m"
551
- ]
552
- }
553
- ],
554
- "source": [
555
- "!pip install pickleshare"
556
- ]
557
- },
558
- {
559
- "cell_type": "code",
560
- "execution_count": 16,
561
- "id": "c6d17b7a-fb51-4e10-83b6-c47c4eabdf36",
562
- "metadata": {},
563
- "outputs": [
564
- {
565
- "name": "stdout",
566
- "output_type": "stream",
567
- "text": [
568
- "[Errno 2] No such file or directory: '/outputs/NousResearch/Nous-Hermes-2-Mistral-7B-DPO/a83a8c0d-5838-47ac-ba15-69da87e94619/epoch_3/step_final'\n",
569
- "/workspace/outputs/NousResearch/Nous-Hermes-2-Mistral-7B-DPO/a83a8c0d-5838-47ac-ba15-69da87e94619/epoch_3\n"
570
- ]
571
- }
572
- ],
573
- "source": [
574
- "%cd /outputs/NousResearch/Nous-Hermes-2-Mistral-7B-DPO/a83a8c0d-5838-47ac-ba15-69da87e94619/epoch_3/step_final"
575
- ]
576
- },
577
- {
578
- "cell_type": "code",
579
- "execution_count": 17,
580
- "id": "9e644c65-2937-42a6-b7b4-658f763b2b3a",
581
- "metadata": {},
582
- "outputs": [
583
- {
584
- "name": "stdout",
585
- "output_type": "stream",
586
- "text": [
587
- "/workspace/outputs/NousResearch/Nous-Hermes-2-Mistral-7B-DPO/a83a8c0d-5838-47ac-ba15-69da87e94619/epoch_3\n"
588
- ]
589
- }
590
- ],
591
- "source": [
592
- "!pwd"
593
- ]
594
- },
595
- {
596
- "cell_type": "code",
597
- "execution_count": null,
598
- "id": "be54ebe7-5970-46d2-b5dd-61da9670b1d9",
599
- "metadata": {},
600
- "outputs": [
601
- {
602
- "data": {
603
- "application/vnd.jupyter.widget-view+json": {
604
- "model_id": "83b5e3d4e3c34a7ea9f2ef61e59af30a",
605
- "version_major": 2,
606
- "version_minor": 0
607
- },
608
- "text/plain": [
609
- "Upload 3 LFS files: 0%| | 0/3 [00:00<?, ?it/s]"
610
- ]
611
- },
612
- "metadata": {},
613
- "output_type": "display_data"
614
- },
615
- {
616
- "data": {
617
- "application/vnd.jupyter.widget-view+json": {
618
- "model_id": "3cf26060d2354c9391518f745d9015fd",
619
- "version_major": 2,
620
- "version_minor": 0
621
- },
622
- "text/plain": [
623
- "tokenizer.model: 0%| | 0.00/493k [00:00<?, ?B/s]"
624
- ]
625
- },
626
- "metadata": {},
627
- "output_type": "display_data"
628
- },
629
- {
630
- "data": {
631
- "application/vnd.jupyter.widget-view+json": {
632
- "model_id": "541431de504e420eb35dda77b7de8a3c",
633
- "version_major": 2,
634
- "version_minor": 0
635
- },
636
- "text/plain": [
637
- "pytorch_model-00001-of-00002.bin: 0%| | 0.00/9.94G [00:00<?, ?B/s]"
638
- ]
639
- },
640
- "metadata": {},
641
- "output_type": "display_data"
642
- },
643
- {
644
- "data": {
645
- "application/vnd.jupyter.widget-view+json": {
646
- "model_id": "24f509ed004745fba85a9e250bb6cd05",
647
- "version_major": 2,
648
- "version_minor": 0
649
- },
650
- "text/plain": [
651
- "pytorch_model-00002-of-00002.bin: 0%| | 0.00/4.54G [00:00<?, ?B/s]"
652
- ]
653
- },
654
- "metadata": {},
655
- "output_type": "display_data"
656
- }
657
- ],
658
- "source": [
659
- "from huggingface_hub import HfApi, HfFolder\n",
660
- "import os\n",
661
- "\n",
662
- "def upload_files_to_hub(directory, repo_name, username, private=False):\n",
663
- " \"\"\"\n",
664
- " Uploads files from a specified directory to a Hugging Face Hub repository using the HTTP-based API.\n",
665
- "\n",
666
- " Parameters:\n",
667
- " - directory: The local directory where your files are stored.\n",
668
- " - repo_name: The name of the repository on the Hugging Face Hub.\n",
669
- " - username: Your Hugging Face username.\n",
670
- " - private: (Optional) Whether to create a private repository. Defaults to False.\n",
671
- " \"\"\"\n",
672
- " # Ensure the directory is an absolute path\n",
673
- " directory = os.path.abspath(directory)\n",
674
- "\n",
675
- " # Instantiate HfApi object\n",
676
- " api = HfApi()\n",
677
- "\n",
678
- " # Get token\n",
679
- " token = HfFolder.get_token()\n",
680
- " if token is None:\n",
681
- " raise ValueError(\"You must be logged in to Hugging Face. Use `huggingface-cli login`.\")\n",
682
- "\n",
683
- " # Correctly specify the repository ID\n",
684
- " repo_id = f\"{username}/{repo_name}\"\n",
685
- "\n",
686
- " # Check if the repository exists, and create it if it does not\n",
687
- " try:\n",
688
- " repo_url = api.create_repo(token=token, repo_id=repo_id, private=private, exist_ok=True)\n",
689
- " except Exception as e:\n",
690
- " print(f\"Error creating repository: {e}\")\n",
691
- " return\n",
692
- "\n",
693
- " # Upload directory to repository\n",
694
- " try:\n",
695
- " api.upload_folder(token=token, repo_id=repo_id, folder_path=directory, path_in_repo=\"\")\n",
696
- " print(f\"Files successfully uploaded to: {repo_url}\")\n",
697
- " except Exception as e:\n",
698
- " print(f\"Error uploading files to the repository: {e}\")\n",
699
- "\n",
700
- "# Example usage\n",
701
- "upload_files_to_hub(directory=\".\", repo_name=\"clau_creat\", username=\"arthrod\", private=False)"
702
- ]
703
- },
704
- {
705
- "cell_type": "code",
706
- "execution_count": null,
707
- "id": "a93ce8ca-1e47-4dfb-b8d7-7ebec869f842",
708
- "metadata": {},
709
- "outputs": [],
710
- "source": []
711
- }
712
- ],
713
- "metadata": {
714
- "kernelspec": {
715
- "display_name": "Python 3 (ipykernel)",
716
- "language": "python",
717
- "name": "python3"
718
- },
719
- "language_info": {
720
- "codemirror_mode": {
721
- "name": "ipython",
722
- "version": 3
723
- },
724
- "file_extension": ".py",
725
- "mimetype": "text/x-python",
726
- "name": "python",
727
- "nbconvert_exporter": "python",
728
- "pygments_lexer": "ipython3",
729
- "version": "3.10.13"
730
- }
731
- },
732
- "nbformat": 4,
733
- "nbformat_minor": 5
734
- }