huggingface-hub 0.24.6__py3-none-any.whl → 0.25.0rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of huggingface-hub might be problematic. Click here for more details.
- huggingface_hub/__init__.py +21 -1
- huggingface_hub/_commit_api.py +4 -4
- huggingface_hub/_inference_endpoints.py +13 -1
- huggingface_hub/_local_folder.py +191 -4
- huggingface_hub/_login.py +6 -6
- huggingface_hub/_snapshot_download.py +8 -17
- huggingface_hub/_space_api.py +5 -0
- huggingface_hub/_tensorboard_logger.py +29 -13
- huggingface_hub/_upload_large_folder.py +573 -0
- huggingface_hub/_webhooks_server.py +1 -1
- huggingface_hub/commands/_cli_utils.py +5 -0
- huggingface_hub/commands/download.py +8 -0
- huggingface_hub/commands/huggingface_cli.py +6 -1
- huggingface_hub/commands/lfs.py +2 -1
- huggingface_hub/commands/repo_files.py +2 -2
- huggingface_hub/commands/scan_cache.py +99 -57
- huggingface_hub/commands/tag.py +1 -1
- huggingface_hub/commands/upload.py +2 -1
- huggingface_hub/commands/upload_large_folder.py +129 -0
- huggingface_hub/commands/version.py +37 -0
- huggingface_hub/community.py +2 -2
- huggingface_hub/errors.py +218 -1
- huggingface_hub/fastai_utils.py +2 -3
- huggingface_hub/file_download.py +63 -63
- huggingface_hub/hf_api.py +758 -314
- huggingface_hub/hf_file_system.py +15 -23
- huggingface_hub/hub_mixin.py +27 -25
- huggingface_hub/inference/_client.py +78 -127
- huggingface_hub/inference/_generated/_async_client.py +169 -144
- huggingface_hub/inference/_generated/types/base.py +0 -9
- huggingface_hub/inference/_templating.py +2 -3
- huggingface_hub/inference_api.py +2 -2
- huggingface_hub/keras_mixin.py +2 -2
- huggingface_hub/lfs.py +7 -98
- huggingface_hub/repocard.py +6 -5
- huggingface_hub/repository.py +5 -5
- huggingface_hub/serialization/_torch.py +64 -11
- huggingface_hub/utils/__init__.py +13 -14
- huggingface_hub/utils/_cache_manager.py +97 -14
- huggingface_hub/utils/_fixes.py +18 -2
- huggingface_hub/utils/_http.py +228 -2
- huggingface_hub/utils/_lfs.py +110 -0
- huggingface_hub/utils/_runtime.py +7 -1
- huggingface_hub/utils/_token.py +3 -2
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/METADATA +2 -2
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/RECORD +50 -48
- huggingface_hub/inference/_types.py +0 -52
- huggingface_hub/utils/_errors.py +0 -397
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/LICENSE +0 -0
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/WHEEL +0 -0
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/entry_points.txt +0 -0
- {huggingface_hub-0.24.6.dist-info → huggingface_hub-0.25.0rc0.dist-info}/top_level.txt +0 -0
huggingface_hub/utils/_http.py
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import io
|
|
18
18
|
import os
|
|
19
|
+
import re
|
|
19
20
|
import threading
|
|
20
21
|
import time
|
|
21
22
|
import uuid
|
|
@@ -24,14 +25,25 @@ from http import HTTPStatus
|
|
|
24
25
|
from typing import Callable, Optional, Tuple, Type, Union
|
|
25
26
|
|
|
26
27
|
import requests
|
|
27
|
-
from requests import Response
|
|
28
|
+
from requests import HTTPError, Response
|
|
28
29
|
from requests.adapters import HTTPAdapter
|
|
29
30
|
from requests.models import PreparedRequest
|
|
30
31
|
|
|
31
32
|
from huggingface_hub.errors import OfflineModeIsEnabled
|
|
32
33
|
|
|
33
34
|
from .. import constants
|
|
35
|
+
from ..errors import (
|
|
36
|
+
BadRequestError,
|
|
37
|
+
DisabledRepoError,
|
|
38
|
+
EntryNotFoundError,
|
|
39
|
+
GatedRepoError,
|
|
40
|
+
HfHubHTTPError,
|
|
41
|
+
RepositoryNotFoundError,
|
|
42
|
+
RevisionNotFoundError,
|
|
43
|
+
)
|
|
34
44
|
from . import logging
|
|
45
|
+
from ._fixes import JSONDecodeError
|
|
46
|
+
from ._lfs import SliceFileObj
|
|
35
47
|
from ._typing import HTTP_METHOD_T
|
|
36
48
|
|
|
37
49
|
|
|
@@ -43,6 +55,21 @@ logger = logging.get_logger(__name__)
|
|
|
43
55
|
X_AMZN_TRACE_ID = "X-Amzn-Trace-Id"
|
|
44
56
|
X_REQUEST_ID = "x-request-id"
|
|
45
57
|
|
|
58
|
+
REPO_API_REGEX = re.compile(
|
|
59
|
+
r"""
|
|
60
|
+
# staging or production endpoint
|
|
61
|
+
^https://[^/]+
|
|
62
|
+
(
|
|
63
|
+
# on /api/repo_type/repo_id
|
|
64
|
+
/api/(models|datasets|spaces)/(.+)
|
|
65
|
+
|
|
|
66
|
+
# or /repo_id/resolve/revision/...
|
|
67
|
+
/(.+)/resolve/(.+)
|
|
68
|
+
)
|
|
69
|
+
""",
|
|
70
|
+
flags=re.VERBOSE,
|
|
71
|
+
)
|
|
72
|
+
|
|
46
73
|
|
|
47
74
|
class UniqueRequestIdAdapter(HTTPAdapter):
|
|
48
75
|
X_AMZN_TRACE_ID = "X-Amzn-Trace-Id"
|
|
@@ -264,7 +291,7 @@ def http_backoff(
|
|
|
264
291
|
# first HTTP request. We need to save the initial position so that the full content
|
|
265
292
|
# of the file is re-sent on http backoff. See warning tip in docstring.
|
|
266
293
|
io_obj_initial_pos = None
|
|
267
|
-
if "data" in kwargs and isinstance(kwargs["data"], io.IOBase):
|
|
294
|
+
if "data" in kwargs and isinstance(kwargs["data"], (io.IOBase, SliceFileObj)):
|
|
268
295
|
io_obj_initial_pos = kwargs["data"].tell()
|
|
269
296
|
|
|
270
297
|
session = get_session()
|
|
@@ -317,3 +344,202 @@ def fix_hf_endpoint_in_url(url: str, endpoint: Optional[str]) -> str:
|
|
|
317
344
|
url = url.replace(constants._HF_DEFAULT_ENDPOINT, endpoint)
|
|
318
345
|
url = url.replace(constants._HF_DEFAULT_STAGING_ENDPOINT, endpoint)
|
|
319
346
|
return url
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
def hf_raise_for_status(response: Response, endpoint_name: Optional[str] = None) -> None:
|
|
350
|
+
"""
|
|
351
|
+
Internal version of `response.raise_for_status()` that will refine a
|
|
352
|
+
potential HTTPError. Raised exception will be an instance of `HfHubHTTPError`.
|
|
353
|
+
|
|
354
|
+
This helper is meant to be the unique method to raise_for_status when making a call
|
|
355
|
+
to the Hugging Face Hub.
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
Example:
|
|
359
|
+
```py
|
|
360
|
+
import requests
|
|
361
|
+
from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError
|
|
362
|
+
|
|
363
|
+
response = get_session().post(...)
|
|
364
|
+
try:
|
|
365
|
+
hf_raise_for_status(response)
|
|
366
|
+
except HfHubHTTPError as e:
|
|
367
|
+
print(str(e)) # formatted message
|
|
368
|
+
e.request_id, e.server_message # details returned by server
|
|
369
|
+
|
|
370
|
+
# Complete the error message with additional information once it's raised
|
|
371
|
+
e.append_to_message("\n`create_commit` expects the repository to exist.")
|
|
372
|
+
raise
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
response (`Response`):
|
|
377
|
+
Response from the server.
|
|
378
|
+
endpoint_name (`str`, *optional*):
|
|
379
|
+
Name of the endpoint that has been called. If provided, the error message
|
|
380
|
+
will be more complete.
|
|
381
|
+
|
|
382
|
+
<Tip warning={true}>
|
|
383
|
+
|
|
384
|
+
Raises when the request has failed:
|
|
385
|
+
|
|
386
|
+
- [`~utils.RepositoryNotFoundError`]
|
|
387
|
+
If the repository to download from cannot be found. This may be because it
|
|
388
|
+
doesn't exist, because `repo_type` is not set correctly, or because the repo
|
|
389
|
+
is `private` and you do not have access.
|
|
390
|
+
- [`~utils.GatedRepoError`]
|
|
391
|
+
If the repository exists but is gated and the user is not on the authorized
|
|
392
|
+
list.
|
|
393
|
+
- [`~utils.RevisionNotFoundError`]
|
|
394
|
+
If the repository exists but the revision couldn't be find.
|
|
395
|
+
- [`~utils.EntryNotFoundError`]
|
|
396
|
+
If the repository exists but the entry (e.g. the requested file) couldn't be
|
|
397
|
+
find.
|
|
398
|
+
- [`~utils.BadRequestError`]
|
|
399
|
+
If request failed with a HTTP 400 BadRequest error.
|
|
400
|
+
- [`~utils.HfHubHTTPError`]
|
|
401
|
+
If request failed for a reason not listed above.
|
|
402
|
+
|
|
403
|
+
</Tip>
|
|
404
|
+
"""
|
|
405
|
+
try:
|
|
406
|
+
response.raise_for_status()
|
|
407
|
+
except HTTPError as e:
|
|
408
|
+
error_code = response.headers.get("X-Error-Code")
|
|
409
|
+
error_message = response.headers.get("X-Error-Message")
|
|
410
|
+
|
|
411
|
+
if error_code == "RevisionNotFound":
|
|
412
|
+
message = f"{response.status_code} Client Error." + "\n\n" + f"Revision Not Found for url: {response.url}."
|
|
413
|
+
raise _format(RevisionNotFoundError, message, response) from e
|
|
414
|
+
|
|
415
|
+
elif error_code == "EntryNotFound":
|
|
416
|
+
message = f"{response.status_code} Client Error." + "\n\n" + f"Entry Not Found for url: {response.url}."
|
|
417
|
+
raise _format(EntryNotFoundError, message, response) from e
|
|
418
|
+
|
|
419
|
+
elif error_code == "GatedRepo":
|
|
420
|
+
message = (
|
|
421
|
+
f"{response.status_code} Client Error." + "\n\n" + f"Cannot access gated repo for url {response.url}."
|
|
422
|
+
)
|
|
423
|
+
raise _format(GatedRepoError, message, response) from e
|
|
424
|
+
|
|
425
|
+
elif error_message == "Access to this resource is disabled.":
|
|
426
|
+
message = (
|
|
427
|
+
f"{response.status_code} Client Error."
|
|
428
|
+
+ "\n\n"
|
|
429
|
+
+ f"Cannot access repository for url {response.url}."
|
|
430
|
+
+ "\n"
|
|
431
|
+
+ "Access to this resource is disabled."
|
|
432
|
+
)
|
|
433
|
+
raise _format(DisabledRepoError, message, response) from e
|
|
434
|
+
|
|
435
|
+
elif error_code == "RepoNotFound" or (
|
|
436
|
+
response.status_code == 401
|
|
437
|
+
and response.request is not None
|
|
438
|
+
and response.request.url is not None
|
|
439
|
+
and REPO_API_REGEX.search(response.request.url) is not None
|
|
440
|
+
):
|
|
441
|
+
# 401 is misleading as it is returned for:
|
|
442
|
+
# - private and gated repos if user is not authenticated
|
|
443
|
+
# - missing repos
|
|
444
|
+
# => for now, we process them as `RepoNotFound` anyway.
|
|
445
|
+
# See https://gist.github.com/Wauplin/46c27ad266b15998ce56a6603796f0b9
|
|
446
|
+
message = (
|
|
447
|
+
f"{response.status_code} Client Error."
|
|
448
|
+
+ "\n\n"
|
|
449
|
+
+ f"Repository Not Found for url: {response.url}."
|
|
450
|
+
+ "\nPlease make sure you specified the correct `repo_id` and"
|
|
451
|
+
" `repo_type`.\nIf you are trying to access a private or gated repo,"
|
|
452
|
+
" make sure you are authenticated."
|
|
453
|
+
)
|
|
454
|
+
raise _format(RepositoryNotFoundError, message, response) from e
|
|
455
|
+
|
|
456
|
+
elif response.status_code == 400:
|
|
457
|
+
message = (
|
|
458
|
+
f"\n\nBad request for {endpoint_name} endpoint:" if endpoint_name is not None else "\n\nBad request:"
|
|
459
|
+
)
|
|
460
|
+
raise _format(BadRequestError, message, response) from e
|
|
461
|
+
|
|
462
|
+
elif response.status_code == 403:
|
|
463
|
+
message = (
|
|
464
|
+
f"\n\n{response.status_code} Forbidden: {error_message}."
|
|
465
|
+
+ f"\nCannot access content at: {response.url}."
|
|
466
|
+
+ "\nMake sure your token has the correct permissions."
|
|
467
|
+
)
|
|
468
|
+
raise _format(HfHubHTTPError, message, response) from e
|
|
469
|
+
|
|
470
|
+
elif response.status_code == 416:
|
|
471
|
+
range_header = response.request.headers.get("Range")
|
|
472
|
+
message = f"{e}. Requested range: {range_header}. Content-Range: {response.headers.get('Content-Range')}."
|
|
473
|
+
raise _format(HfHubHTTPError, message, response) from e
|
|
474
|
+
|
|
475
|
+
# Convert `HTTPError` into a `HfHubHTTPError` to display request information
|
|
476
|
+
# as well (request id and/or server error message)
|
|
477
|
+
raise _format(HfHubHTTPError, str(e), response) from e
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
def _format(error_type: Type[HfHubHTTPError], custom_message: str, response: Response) -> HfHubHTTPError:
|
|
481
|
+
server_errors = []
|
|
482
|
+
|
|
483
|
+
# Retrieve server error from header
|
|
484
|
+
from_headers = response.headers.get("X-Error-Message")
|
|
485
|
+
if from_headers is not None:
|
|
486
|
+
server_errors.append(from_headers)
|
|
487
|
+
|
|
488
|
+
# Retrieve server error from body
|
|
489
|
+
try:
|
|
490
|
+
# Case errors are returned in a JSON format
|
|
491
|
+
data = response.json()
|
|
492
|
+
|
|
493
|
+
error = data.get("error")
|
|
494
|
+
if error is not None:
|
|
495
|
+
if isinstance(error, list):
|
|
496
|
+
# Case {'error': ['my error 1', 'my error 2']}
|
|
497
|
+
server_errors.extend(error)
|
|
498
|
+
else:
|
|
499
|
+
# Case {'error': 'my error'}
|
|
500
|
+
server_errors.append(error)
|
|
501
|
+
|
|
502
|
+
errors = data.get("errors")
|
|
503
|
+
if errors is not None:
|
|
504
|
+
# Case {'errors': [{'message': 'my error 1'}, {'message': 'my error 2'}]}
|
|
505
|
+
for error in errors:
|
|
506
|
+
if "message" in error:
|
|
507
|
+
server_errors.append(error["message"])
|
|
508
|
+
|
|
509
|
+
except JSONDecodeError:
|
|
510
|
+
# Case error is directly returned as text
|
|
511
|
+
if response.text:
|
|
512
|
+
server_errors.append(response.text)
|
|
513
|
+
|
|
514
|
+
# Strip all server messages
|
|
515
|
+
server_errors = [line.strip() for line in server_errors if line.strip()]
|
|
516
|
+
|
|
517
|
+
# Deduplicate server messages (keep order)
|
|
518
|
+
# taken from https://stackoverflow.com/a/17016257
|
|
519
|
+
server_errors = list(dict.fromkeys(server_errors))
|
|
520
|
+
|
|
521
|
+
# Format server error
|
|
522
|
+
server_message = "\n".join(server_errors)
|
|
523
|
+
|
|
524
|
+
# Add server error to custom message
|
|
525
|
+
final_error_message = custom_message
|
|
526
|
+
if server_message and server_message.lower() not in custom_message.lower():
|
|
527
|
+
if "\n\n" in custom_message:
|
|
528
|
+
final_error_message += "\n" + server_message
|
|
529
|
+
else:
|
|
530
|
+
final_error_message += "\n\n" + server_message
|
|
531
|
+
|
|
532
|
+
# Add Request ID
|
|
533
|
+
request_id = str(response.headers.get(X_REQUEST_ID, ""))
|
|
534
|
+
if len(request_id) > 0 and request_id.lower() not in final_error_message.lower():
|
|
535
|
+
request_id_message = f" (Request ID: {request_id})"
|
|
536
|
+
if "\n" in final_error_message:
|
|
537
|
+
newline_index = final_error_message.index("\n")
|
|
538
|
+
final_error_message = (
|
|
539
|
+
final_error_message[:newline_index] + request_id_message + final_error_message[newline_index:]
|
|
540
|
+
)
|
|
541
|
+
else:
|
|
542
|
+
final_error_message += request_id_message
|
|
543
|
+
|
|
544
|
+
# Return
|
|
545
|
+
return error_type(final_error_message.strip(), response=response, server_message=server_message or None)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
# Copyright 2019-present, the HuggingFace Inc. team.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
"""Git LFS related utilities"""
|
|
16
|
+
|
|
17
|
+
import io
|
|
18
|
+
import os
|
|
19
|
+
from contextlib import AbstractContextManager
|
|
20
|
+
from typing import BinaryIO
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SliceFileObj(AbstractContextManager):
|
|
24
|
+
"""
|
|
25
|
+
Utility context manager to read a *slice* of a seekable file-like object as a seekable, file-like object.
|
|
26
|
+
|
|
27
|
+
This is NOT thread safe
|
|
28
|
+
|
|
29
|
+
Inspired by stackoverflow.com/a/29838711/593036
|
|
30
|
+
|
|
31
|
+
Credits to @julien-c
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
fileobj (`BinaryIO`):
|
|
35
|
+
A file-like object to slice. MUST implement `tell()` and `seek()` (and `read()` of course).
|
|
36
|
+
`fileobj` will be reset to its original position when exiting the context manager.
|
|
37
|
+
seek_from (`int`):
|
|
38
|
+
The start of the slice (offset from position 0 in bytes).
|
|
39
|
+
read_limit (`int`):
|
|
40
|
+
The maximum number of bytes to read from the slice.
|
|
41
|
+
|
|
42
|
+
Attributes:
|
|
43
|
+
previous_position (`int`):
|
|
44
|
+
The previous position
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
|
|
48
|
+
Reading 200 bytes with an offset of 128 bytes from a file (ie bytes 128 to 327):
|
|
49
|
+
```python
|
|
50
|
+
>>> with open("path/to/file", "rb") as file:
|
|
51
|
+
... with SliceFileObj(file, seek_from=128, read_limit=200) as fslice:
|
|
52
|
+
... fslice.read(...)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Reading a file in chunks of 512 bytes
|
|
56
|
+
```python
|
|
57
|
+
>>> import os
|
|
58
|
+
>>> chunk_size = 512
|
|
59
|
+
>>> file_size = os.getsize("path/to/file")
|
|
60
|
+
>>> with open("path/to/file", "rb") as file:
|
|
61
|
+
... for chunk_idx in range(ceil(file_size / chunk_size)):
|
|
62
|
+
... with SliceFileObj(file, seek_from=chunk_idx * chunk_size, read_limit=chunk_size) as fslice:
|
|
63
|
+
... chunk = fslice.read(...)
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def __init__(self, fileobj: BinaryIO, seek_from: int, read_limit: int):
|
|
69
|
+
self.fileobj = fileobj
|
|
70
|
+
self.seek_from = seek_from
|
|
71
|
+
self.read_limit = read_limit
|
|
72
|
+
|
|
73
|
+
def __enter__(self):
|
|
74
|
+
self._previous_position = self.fileobj.tell()
|
|
75
|
+
end_of_stream = self.fileobj.seek(0, os.SEEK_END)
|
|
76
|
+
self._len = min(self.read_limit, end_of_stream - self.seek_from)
|
|
77
|
+
# ^^ The actual number of bytes that can be read from the slice
|
|
78
|
+
self.fileobj.seek(self.seek_from, io.SEEK_SET)
|
|
79
|
+
return self
|
|
80
|
+
|
|
81
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
82
|
+
self.fileobj.seek(self._previous_position, io.SEEK_SET)
|
|
83
|
+
|
|
84
|
+
def read(self, n: int = -1):
|
|
85
|
+
pos = self.tell()
|
|
86
|
+
if pos >= self._len:
|
|
87
|
+
return b""
|
|
88
|
+
remaining_amount = self._len - pos
|
|
89
|
+
data = self.fileobj.read(remaining_amount if n < 0 else min(n, remaining_amount))
|
|
90
|
+
return data
|
|
91
|
+
|
|
92
|
+
def tell(self) -> int:
|
|
93
|
+
return self.fileobj.tell() - self.seek_from
|
|
94
|
+
|
|
95
|
+
def seek(self, offset: int, whence: int = os.SEEK_SET) -> int:
|
|
96
|
+
start = self.seek_from
|
|
97
|
+
end = start + self._len
|
|
98
|
+
if whence in (os.SEEK_SET, os.SEEK_END):
|
|
99
|
+
offset = start + offset if whence == os.SEEK_SET else end + offset
|
|
100
|
+
offset = max(start, min(offset, end))
|
|
101
|
+
whence = os.SEEK_SET
|
|
102
|
+
elif whence == os.SEEK_CUR:
|
|
103
|
+
cur_pos = self.fileobj.tell()
|
|
104
|
+
offset = max(start - cur_pos, min(offset, end - cur_pos))
|
|
105
|
+
else:
|
|
106
|
+
raise ValueError(f"whence value {whence} is not supported")
|
|
107
|
+
return self.fileobj.seek(offset, whence) - self.seek_from
|
|
108
|
+
|
|
109
|
+
def __iter__(self):
|
|
110
|
+
yield self.read(n=4 * 1024 * 1024)
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"""Check presence of installed packages at runtime."""
|
|
16
16
|
|
|
17
17
|
import importlib.metadata
|
|
18
|
+
import os
|
|
18
19
|
import platform
|
|
19
20
|
import sys
|
|
20
21
|
import warnings
|
|
@@ -302,6 +303,11 @@ def is_google_colab() -> bool:
|
|
|
302
303
|
return _is_google_colab
|
|
303
304
|
|
|
304
305
|
|
|
306
|
+
def is_colab_enterprise() -> bool:
|
|
307
|
+
"""Return `True` if code is executed in a Google Colab Enterprise environment."""
|
|
308
|
+
return os.environ.get("VERTEX_PRODUCT") == "COLAB_ENTERPRISE"
|
|
309
|
+
|
|
310
|
+
|
|
305
311
|
def dump_environment_info() -> Dict[str, Any]:
|
|
306
312
|
"""Dump information about the machine to help debugging issues.
|
|
307
313
|
|
|
@@ -331,7 +337,7 @@ def dump_environment_info() -> Dict[str, Any]:
|
|
|
331
337
|
info["Running in iPython ?"] = "No"
|
|
332
338
|
info["Running in notebook ?"] = "Yes" if is_notebook() else "No"
|
|
333
339
|
info["Running in Google Colab ?"] = "Yes" if is_google_colab() else "No"
|
|
334
|
-
|
|
340
|
+
info["Running in Google Colab Enterprise ?"] = "Yes" if is_colab_enterprise() else "No"
|
|
335
341
|
# Login info
|
|
336
342
|
info["Token path ?"] = constants.HF_TOKEN_PATH
|
|
337
343
|
info["Has saved token ?"] = token is not None
|
huggingface_hub/utils/_token.py
CHANGED
|
@@ -20,7 +20,7 @@ from threading import Lock
|
|
|
20
20
|
from typing import Optional
|
|
21
21
|
|
|
22
22
|
from .. import constants
|
|
23
|
-
from ._runtime import is_google_colab
|
|
23
|
+
from ._runtime import is_colab_enterprise, is_google_colab
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
_IS_GOOGLE_COLAB_CHECKED = False
|
|
@@ -51,7 +51,8 @@ def _get_token_from_google_colab() -> Optional[str]:
|
|
|
51
51
|
Token is read from the vault only once per session and then stored in a global variable to avoid re-requesting
|
|
52
52
|
access to the vault.
|
|
53
53
|
"""
|
|
54
|
-
|
|
54
|
+
# If it's not a Google Colab or it's Colab Enterprise, fallback to environment variable or token file authentication
|
|
55
|
+
if not is_google_colab() or is_colab_enterprise():
|
|
55
56
|
return None
|
|
56
57
|
|
|
57
58
|
# `google.colab.userdata` is not thread-safe
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: huggingface-hub
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.0rc0
|
|
4
4
|
Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
|
|
5
5
|
Home-page: https://github.com/huggingface/huggingface_hub
|
|
6
6
|
Author: Hugging Face, Inc.
|
|
@@ -233,7 +233,7 @@ Files will be downloaded in a local cache folder. More details in [this guide](h
|
|
|
233
233
|
|
|
234
234
|
### Login
|
|
235
235
|
|
|
236
|
-
The Hugging Face Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). To
|
|
236
|
+
The Hugging Face Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). To log in your machine, run the following CLI:
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
239
|
huggingface-cli login
|
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
huggingface_hub/__init__.py,sha256=
|
|
2
|
-
huggingface_hub/_commit_api.py,sha256=
|
|
1
|
+
huggingface_hub/__init__.py,sha256=1dpvMU4PdU3S6Ws08T8VSpQtendIQlV8XFHg55-I_d8,34577
|
|
2
|
+
huggingface_hub/_commit_api.py,sha256=Y9eTaW4bYzxtrZsSniVtfeAuFafqx8x1ofMI5es8hvM,31057
|
|
3
3
|
huggingface_hub/_commit_scheduler.py,sha256=nlJS_vnLb8i92NLrRwJX8Mg9QZ7f3kfLbLlQuEd5YjU,13647
|
|
4
|
-
huggingface_hub/_inference_endpoints.py,sha256=
|
|
5
|
-
huggingface_hub/_local_folder.py,sha256=
|
|
6
|
-
huggingface_hub/_login.py,sha256=
|
|
4
|
+
huggingface_hub/_inference_endpoints.py,sha256=wzjD8P68VpUDHzIDbXzFXsM2Y-aNVSAap7BXsZFuthk,16750
|
|
5
|
+
huggingface_hub/_local_folder.py,sha256=PBycy5l4iyugz0NCExSfbSon1IwqPiblC6Xy4eeFYCU,16392
|
|
6
|
+
huggingface_hub/_login.py,sha256=WXVv4e7almLbmVQuq4NR78TPLm4RDmzNZr4vrl2gbLI,15484
|
|
7
7
|
huggingface_hub/_multi_commits.py,sha256=mFmCP_5hNsruEgDF6kOVyaFkpnbSdNxPWfGUlFbl5O8,12535
|
|
8
|
-
huggingface_hub/_snapshot_download.py,sha256=
|
|
9
|
-
huggingface_hub/_space_api.py,sha256=
|
|
10
|
-
huggingface_hub/_tensorboard_logger.py,sha256=
|
|
8
|
+
huggingface_hub/_snapshot_download.py,sha256=Dbm7aPH8xrKJGE6A7aSw6YG3HgMT-VacL2s18Ut9NYA,14321
|
|
9
|
+
huggingface_hub/_space_api.py,sha256=QVOUNty2T4RxPoxf9FzUjXmjHiGXP0mqXJzqQ7GmoJo,5363
|
|
10
|
+
huggingface_hub/_tensorboard_logger.py,sha256=F-2l3BsHVEar8PSFhPOwprMsvkwprPgpkOTWqeMMobM,8299
|
|
11
|
+
huggingface_hub/_upload_large_folder.py,sha256=_HhfBp40qXbVBR_NCctdVt_PIqzLhAFaKwPU22Y0Ei0,21534
|
|
11
12
|
huggingface_hub/_webhooks_payload.py,sha256=Xm3KaK7tCOGBlXkuZvbym6zjHXrT1XCrbUFWuXiBmNY,3617
|
|
12
|
-
huggingface_hub/_webhooks_server.py,sha256=
|
|
13
|
-
huggingface_hub/community.py,sha256=
|
|
13
|
+
huggingface_hub/_webhooks_server.py,sha256=oCvpFrYjrhJjClAMw26SQfvN4DUItgK2IhFp1OVh2bU,15623
|
|
14
|
+
huggingface_hub/community.py,sha256=4MtcoxEI9_0lmmilBEnvUEi8_O1Ivfa8p6eKxYU5-ts,12198
|
|
14
15
|
huggingface_hub/constants.py,sha256=BG3n2gl4JbxMw_JRvNTFyMcNnZIPzvT3KXSH-jm2J08,8005
|
|
15
|
-
huggingface_hub/errors.py,sha256=
|
|
16
|
-
huggingface_hub/fastai_utils.py,sha256=
|
|
17
|
-
huggingface_hub/file_download.py,sha256=
|
|
18
|
-
huggingface_hub/hf_api.py,sha256=
|
|
19
|
-
huggingface_hub/hf_file_system.py,sha256
|
|
20
|
-
huggingface_hub/hub_mixin.py,sha256=
|
|
21
|
-
huggingface_hub/inference_api.py,sha256=
|
|
22
|
-
huggingface_hub/keras_mixin.py,sha256=
|
|
23
|
-
huggingface_hub/lfs.py,sha256=
|
|
24
|
-
huggingface_hub/repocard.py,sha256=
|
|
16
|
+
huggingface_hub/errors.py,sha256=kENdHLaBExWdu_dFJumYz7FFgLiROI4qgSvt03fJRec,9261
|
|
17
|
+
huggingface_hub/fastai_utils.py,sha256=o0BnmigoNP3H7Sf8w8bwuRaN-9FKlL6uoPawr4HSyjc,16647
|
|
18
|
+
huggingface_hub/file_download.py,sha256=LYbLa0OKoSeis7d3j6mB2V-IJqAkV18wYwqRSl-VTKs,85412
|
|
19
|
+
huggingface_hub/hf_api.py,sha256=zeSuER_7gpe4qdxbKMTJbB0s9drQ-ut10WFmrDWVnTQ,432101
|
|
20
|
+
huggingface_hub/hf_file_system.py,sha256=-TfO8cnfsQTxwzd-K6vjrbGkziNrAyiSHDHu_ss1U-I,39148
|
|
21
|
+
huggingface_hub/hub_mixin.py,sha256=ZeCxje9e42-pm78dVhUDoQZQchXH3i1svy5CzOL3l7o,37554
|
|
22
|
+
huggingface_hub/inference_api.py,sha256=b4-NhPSn9b44nYKV8tDKXodmE4JVdEymMWL4CVGkzlE,8323
|
|
23
|
+
huggingface_hub/keras_mixin.py,sha256=LReKRHE4y9kN-r7WdqtUYJY2mYKkhN1nJ8Jl6v52P7A,19483
|
|
24
|
+
huggingface_hub/lfs.py,sha256=xQE8HTZmzILey8aqURpD-NO6_z1LUasOJssXiBcm0s4,16827
|
|
25
|
+
huggingface_hub/repocard.py,sha256=2NkzYa4-0NT6Ydyq1TcgcJ07M35YgaP9_9hXUEL7WoE,34641
|
|
25
26
|
huggingface_hub/repocard_data.py,sha256=tATP6rp7MOlbPXVCMGhNMaDP7RmKPQkX_pXtBVOYmRQ,32726
|
|
26
|
-
huggingface_hub/repository.py,sha256=
|
|
27
|
+
huggingface_hub/repository.py,sha256=xVQR-MRKNDfJ_Z_99DwtXZB3xNO06eYG_GvRM4fLiTU,54557
|
|
27
28
|
huggingface_hub/commands/__init__.py,sha256=AkbM2a-iGh0Vq_xAWhK3mu3uZ44km8-X5uWjKcvcrUQ,928
|
|
28
|
-
huggingface_hub/commands/_cli_utils.py,sha256=
|
|
29
|
+
huggingface_hub/commands/_cli_utils.py,sha256=Nt6CjbkYqQQRuh70bUXVA6rZpbZt_Sa1WqBUxjQLu6g,2095
|
|
29
30
|
huggingface_hub/commands/delete_cache.py,sha256=Rb1BtIltJPnQ-th7tcK_L4mFqfk785t3KXV77xXKBP4,16131
|
|
30
|
-
huggingface_hub/commands/download.py,sha256=
|
|
31
|
+
huggingface_hub/commands/download.py,sha256=1YXKttB8YBX7SJ0Jxg0t1n8yp2BUZXtY0ck6DhCg-XE,8183
|
|
31
32
|
huggingface_hub/commands/env.py,sha256=yYl4DSS14V8t244nAi0t77Izx5LIdgS_dy6xiV5VQME,1226
|
|
32
|
-
huggingface_hub/commands/huggingface_cli.py,sha256=
|
|
33
|
-
huggingface_hub/commands/lfs.py,sha256=
|
|
34
|
-
huggingface_hub/commands/repo_files.py,sha256=
|
|
35
|
-
huggingface_hub/commands/scan_cache.py,sha256=
|
|
36
|
-
huggingface_hub/commands/tag.py,sha256=
|
|
37
|
-
huggingface_hub/commands/upload.py,sha256=
|
|
33
|
+
huggingface_hub/commands/huggingface_cli.py,sha256=ZwW_nwgppyj-GA6iM3mgmbXMZ63bgtpGl_yIQDyWS4A,2414
|
|
34
|
+
huggingface_hub/commands/lfs.py,sha256=xdbnNRO04UuQemEhUGT809jFgQn9Rj-SnyT_0Ph-VYg,7342
|
|
35
|
+
huggingface_hub/commands/repo_files.py,sha256=Nfv8TjuaZVOrj7TZjrojtjdD8Wf54aZvYPDEOevh7tA,4923
|
|
36
|
+
huggingface_hub/commands/scan_cache.py,sha256=CSXyIDCzOcxSFwIc_SqUC6J_TIc7uHXjrtCjkmE7k2g,8560
|
|
37
|
+
huggingface_hub/commands/tag.py,sha256=0LNQZyK-WKi0VIL9i1xWzKxJ1ILw1jxMF_E6t2weJss,6288
|
|
38
|
+
huggingface_hub/commands/upload.py,sha256=xMExm68YcR8R_dDRi3bcIC1qVCvRFRW7aP_AGxGZ1rc,13656
|
|
39
|
+
huggingface_hub/commands/upload_large_folder.py,sha256=LKvzEmKeRatBLlnJF__b5jFBQ8bcM2KQgN_Pcf1X5hE,6128
|
|
38
40
|
huggingface_hub/commands/user.py,sha256=QApZJOCQEHADhjunM3hlQ72uqHsearCiCE4SdpzGdcc,6893
|
|
41
|
+
huggingface_hub/commands/version.py,sha256=vfCJn7GO1m-DtDmbdsty8_RTVtnZ7lX6MJsx0Bf4e-s,1266
|
|
39
42
|
huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
huggingface_hub/inference/_client.py,sha256=
|
|
43
|
+
huggingface_hub/inference/_client.py,sha256=yZ8YPWiZk0PEhNIfRsUKuoJij3QKYFqIO3jnJZa8Sho,126997
|
|
41
44
|
huggingface_hub/inference/_common.py,sha256=8JNanqi7rQnFryT_11MFX9siRg-dEDlLtLwPHE6p_Rw,14906
|
|
42
|
-
huggingface_hub/inference/_templating.py,sha256=
|
|
43
|
-
huggingface_hub/inference/_types.py,sha256=C73l5-RO8P1UMBHF8OAO9CRUq7Xdv33pcADoJsGMPSU,1782
|
|
45
|
+
huggingface_hub/inference/_templating.py,sha256=xWPzz_TyQpGOZyVP_ev-gSo92swSRVK8whPAG3bbQpM,3976
|
|
44
46
|
huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
huggingface_hub/inference/_generated/_async_client.py,sha256=
|
|
47
|
+
huggingface_hub/inference/_generated/_async_client.py,sha256=_pfb8C0NV-3-ixB5bblL9-XPgjqh7ECXry7A_InEw6c,133489
|
|
46
48
|
huggingface_hub/inference/_generated/types/__init__.py,sha256=uEsA0z8Gcu34q0gNAZVcqHFqJT5BPrhnM9qS_LQgN0Q,5215
|
|
47
49
|
huggingface_hub/inference/_generated/types/audio_classification.py,sha256=wk4kUTLQZoXWLpiUOpKRHRRE-JYqqJlzGVe62VACR-0,1347
|
|
48
50
|
huggingface_hub/inference/_generated/types/audio_to_audio.py,sha256=n7GeCepzt254yoSLsdjrI1j4fzYgjWzxoaKE5gZJc48,881
|
|
49
51
|
huggingface_hub/inference/_generated/types/automatic_speech_recognition.py,sha256=-7UHu5QTGwSrJFnrbMgzeUFpJQOGyTmfK_QHgtnx6j8,5352
|
|
50
|
-
huggingface_hub/inference/_generated/types/base.py,sha256=
|
|
52
|
+
huggingface_hub/inference/_generated/types/base.py,sha256=dQ-ej4weVueTJQXaDFLYFhKvlCUYVH2k9r-Ck0uhFIU,5870
|
|
51
53
|
huggingface_hub/inference/_generated/types/chat_completion.py,sha256=k8VAiyauZDbSqxQuUQpMTVHBRUho49-ujedYBl3jy8w,8809
|
|
52
54
|
huggingface_hub/inference/_generated/types/depth_estimation.py,sha256=lmLmd8S313ZMCG94RblwquL0UN_0hJmXAhWUqSIrtwc,898
|
|
53
55
|
huggingface_hub/inference/_generated/types/document_question_answering.py,sha256=_hBzK4Pu9X_zXsgOO4JNSloIKuVfE5m7eGwEw5YTfZ4,3264
|
|
@@ -77,29 +79,29 @@ huggingface_hub/inference/_generated/types/zero_shot_object_detection.py,sha256=
|
|
|
77
79
|
huggingface_hub/serialization/__init__.py,sha256=z5MLxMqz0Y2qST-3Lj0PZHUONL-SGRlc0g4Z6MdL6rw,988
|
|
78
80
|
huggingface_hub/serialization/_base.py,sha256=JZneES-HgcRH9C2SQehIGRDtT7nS7emu-RRV4ZjB6xo,8124
|
|
79
81
|
huggingface_hub/serialization/_tensorflow.py,sha256=zHOvEMg-JHC55Fm4roDT3LUCDO5zB9qtXZffG065RAM,3625
|
|
80
|
-
huggingface_hub/serialization/_torch.py,sha256=
|
|
82
|
+
huggingface_hub/serialization/_torch.py,sha256=Q-pRHTU6jnZeLwKMDhQh_2i_KersYKgMrCHMJMHMkwk,26422
|
|
81
83
|
huggingface_hub/templates/datasetcard_template.md,sha256=W-EMqR6wndbrnZorkVv56URWPG49l7MATGeI015kTvs,5503
|
|
82
84
|
huggingface_hub/templates/modelcard_template.md,sha256=4AqArS3cqdtbit5Bo-DhjcnDFR-pza5hErLLTPM4Yuc,6870
|
|
83
|
-
huggingface_hub/utils/__init__.py,sha256=
|
|
85
|
+
huggingface_hub/utils/__init__.py,sha256=ARTtov4ejkwUempOiSxHVBrkb330J6wOrTsu8dqfzaw,3621
|
|
84
86
|
huggingface_hub/utils/_cache_assets.py,sha256=kai77HPQMfYpROouMBQCr_gdBCaeTm996Sqj0dExbNg,5728
|
|
85
|
-
huggingface_hub/utils/_cache_manager.py,sha256=
|
|
87
|
+
huggingface_hub/utils/_cache_manager.py,sha256=kfuZDQy6FbWXrwKqp5sAJHte1BooTYKnjyuS0kbR6Eo,34495
|
|
86
88
|
huggingface_hub/utils/_chunk_utils.py,sha256=kRCaj5228_vKcyLWspd8Xq01f17Jz6ds5Sr9ed5d_RU,2130
|
|
87
89
|
huggingface_hub/utils/_datetime.py,sha256=DHnktKm1taeOe2XCBgNU4pVck5d70qu8FJ7nACD6C3k,2554
|
|
88
90
|
huggingface_hub/utils/_deprecation.py,sha256=HZhRGGUX_QMKBBBwHHlffLtmCSK01TOpeXHefZbPfwI,4872
|
|
89
|
-
huggingface_hub/utils/_errors.py,sha256=q5Y2kUOFnDiAb23_n48xUzy2ezKt73FjVeLSozUzY9Y,15142
|
|
90
91
|
huggingface_hub/utils/_experimental.py,sha256=crCPH6k6-11wwH2GZuZzZzZbjUotay49ywV1SSJhMHM,2395
|
|
91
|
-
huggingface_hub/utils/_fixes.py,sha256=
|
|
92
|
+
huggingface_hub/utils/_fixes.py,sha256=C-feEQOZtXGHP4E2Qlg2VyxWSZhdCVmd0_B6zgiPcWA,4045
|
|
92
93
|
huggingface_hub/utils/_git_credential.py,sha256=SDdsiREr1TcAR2Ze2TB0E5cYzVJgvDZrs60od9lAsMc,4596
|
|
93
94
|
huggingface_hub/utils/_headers.py,sha256=05sDPAi7-Fs3Z4YLbrTJTAbIT7yjSX9DEqotd6gHqhQ,9593
|
|
94
95
|
huggingface_hub/utils/_hf_folder.py,sha256=gWH-TT9h_6X_CyrtLTtKNEawf9kKlCHraFiOu09BuLk,3613
|
|
95
|
-
huggingface_hub/utils/_http.py,sha256
|
|
96
|
+
huggingface_hub/utils/_http.py,sha256=YSxfEopSdHNWNvtuqLe53JIu_v3o1MiJGCo9JTuuEtQ,22339
|
|
97
|
+
huggingface_hub/utils/_lfs.py,sha256=EC0Oz6Wiwl8foRNkUOzrETXzAWlbgpnpxo5a410ovFY,3957
|
|
96
98
|
huggingface_hub/utils/_pagination.py,sha256=hzLFLd8i_DKkPRVYzOx2CxLt5lcocEiAxDJriQUjAjY,1841
|
|
97
99
|
huggingface_hub/utils/_paths.py,sha256=w1ZhFmmD5ykWjp_hAvhjtOoa2ZUcOXJrF4a6O3QpAWo,5042
|
|
98
|
-
huggingface_hub/utils/_runtime.py,sha256=
|
|
100
|
+
huggingface_hub/utils/_runtime.py,sha256=9CtsnxcYYFnCgccq_ea_ElaN_s-cFcuEvPItIzbqM3I,11331
|
|
99
101
|
huggingface_hub/utils/_safetensors.py,sha256=GW3nyv7xQcuwObKYeYoT9VhURVzG1DZTbKBKho8Bbos,4458
|
|
100
102
|
huggingface_hub/utils/_subprocess.py,sha256=6GpGD4qE9-Z1-Ocs3JuCLjR4NcRlknA-hAuQlqiprYY,4595
|
|
101
103
|
huggingface_hub/utils/_telemetry.py,sha256=54LXeIJU5pEGghPAh06gqNAR-UoxOjVLvKqAQscwqZs,4890
|
|
102
|
-
huggingface_hub/utils/_token.py,sha256=
|
|
104
|
+
huggingface_hub/utils/_token.py,sha256=nZftxjMfr1rO5hNH9MJ3tXzRr_-beIkBhrfM8Y936X8,5643
|
|
103
105
|
huggingface_hub/utils/_typing.py,sha256=UO0-GeTbiKFV9GqDh4YNRyScQSRAAZRoUeEYQX4P0rE,2882
|
|
104
106
|
huggingface_hub/utils/_validators.py,sha256=dDsVG31iooTYrIyi5Vwr1DukL0fEmJwu3ceVNduhsuE,9204
|
|
105
107
|
huggingface_hub/utils/endpoint_helpers.py,sha256=9VtIAlxQ5H_4y30sjCAgbu7XCqAtNLC7aRYxaNn0hLI,2366
|
|
@@ -107,9 +109,9 @@ huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-
|
|
|
107
109
|
huggingface_hub/utils/logging.py,sha256=Cp03s0uEl3kDM9XHQW9a8GAoExODQ-e7kEtgMt-_To8,4728
|
|
108
110
|
huggingface_hub/utils/sha.py,sha256=OFnNGCba0sNcT2gUwaVCJnldxlltrHHe0DS_PCpV3C4,2134
|
|
109
111
|
huggingface_hub/utils/tqdm.py,sha256=jQiVYwRG78HK4_54u0vTtz6Kt9IMGiHy3ixbIn3h2TU,9368
|
|
110
|
-
huggingface_hub-0.
|
|
111
|
-
huggingface_hub-0.
|
|
112
|
-
huggingface_hub-0.
|
|
113
|
-
huggingface_hub-0.
|
|
114
|
-
huggingface_hub-0.
|
|
115
|
-
huggingface_hub-0.
|
|
112
|
+
huggingface_hub-0.25.0rc0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
113
|
+
huggingface_hub-0.25.0rc0.dist-info/METADATA,sha256=9drz2hRWlG4ta39dHHvxKI-zi8GoBvQpM0WVK0IUBpg,13057
|
|
114
|
+
huggingface_hub-0.25.0rc0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
115
|
+
huggingface_hub-0.25.0rc0.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
|
|
116
|
+
huggingface_hub-0.25.0rc0.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
|
117
|
+
huggingface_hub-0.25.0rc0.dist-info/RECORD,,
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# Copyright 2023-present, the HuggingFace Inc. team.
|
|
3
|
-
#
|
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
# you may not use this file except in compliance with the License.
|
|
6
|
-
# You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
|
-
from typing import List, TypedDict
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# Legacy types
|
|
20
|
-
# Types are now generated from the JSON schema spec in @huggingface/tasks.
|
|
21
|
-
# See ./src/huggingface_hub/inference/_generated/types
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class ConversationalOutputConversation(TypedDict):
|
|
25
|
-
"""Dictionary containing the "conversation" part of a [`~InferenceClient.conversational`] task.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
generated_responses (`List[str]`):
|
|
29
|
-
A list of the responses from the model.
|
|
30
|
-
past_user_inputs (`List[str]`):
|
|
31
|
-
A list of the inputs from the user. Must be the same length as `generated_responses`.
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
generated_responses: List[str]
|
|
35
|
-
past_user_inputs: List[str]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class ConversationalOutput(TypedDict):
|
|
39
|
-
"""Dictionary containing the output of a [`~InferenceClient.conversational`] task.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
generated_text (`str`):
|
|
43
|
-
The last response from the model.
|
|
44
|
-
conversation (`ConversationalOutputConversation`):
|
|
45
|
-
The past conversation.
|
|
46
|
-
warnings (`List[str]`):
|
|
47
|
-
A list of warnings associated with the process.
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
conversation: ConversationalOutputConversation
|
|
51
|
-
generated_text: str
|
|
52
|
-
warnings: List[str]
|