Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# coding=utf-8
|
||||
# Copyright 2019-present, the HuggingFace Inc. team.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
@ -16,10 +15,11 @@
|
|||
|
||||
import io
|
||||
import re
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass
|
||||
from math import ceil
|
||||
from os.path import getsize
|
||||
from typing import TYPE_CHECKING, BinaryIO, Iterable, Optional, TypedDict
|
||||
from typing import TYPE_CHECKING, BinaryIO, TypedDict
|
||||
from urllib.parse import unquote
|
||||
|
||||
from huggingface_hub import constants
|
||||
|
|
@ -73,7 +73,7 @@ class UploadInfo:
|
|||
@classmethod
|
||||
def from_path(cls, path: str):
|
||||
size = getsize(path)
|
||||
with io.open(path, "rb") as file:
|
||||
with open(path, "rb") as file:
|
||||
sample = file.peek(512)[:512]
|
||||
sha = sha_fileobj(file)
|
||||
return cls(size=size, sha256=sha, sample=sample)
|
||||
|
|
@ -96,14 +96,14 @@ class UploadInfo:
|
|||
@validate_hf_hub_args
|
||||
def post_lfs_batch_info(
|
||||
upload_infos: Iterable[UploadInfo],
|
||||
token: Optional[str],
|
||||
token: str | None,
|
||||
repo_type: str,
|
||||
repo_id: str,
|
||||
revision: Optional[str] = None,
|
||||
endpoint: Optional[str] = None,
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
transfers: Optional[list[str]] = None,
|
||||
) -> tuple[list[dict], list[dict], Optional[str]]:
|
||||
revision: str | None = None,
|
||||
endpoint: str | None = None,
|
||||
headers: dict[str, str] | None = None,
|
||||
transfers: list[str] | None = None,
|
||||
) -> tuple[list[dict], list[dict], str | None]:
|
||||
"""
|
||||
Requests the LFS batch endpoint to retrieve upload instructions
|
||||
|
||||
|
|
@ -113,6 +113,9 @@ def post_lfs_batch_info(
|
|||
upload_infos (`Iterable` of `UploadInfo`):
|
||||
`UploadInfo` for the files that are being uploaded, typically obtained
|
||||
from `CommitOperationAdd.upload_info`
|
||||
token (`str` or `None`):
|
||||
An authentication token (see https://huggingface.co/settings/token).
|
||||
Pass `None` to fall back to the local cached token (or no token if unauthenticated).
|
||||
repo_type (`str`):
|
||||
Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
|
||||
repo_id (`str`):
|
||||
|
|
@ -120,6 +123,8 @@ def post_lfs_batch_info(
|
|||
by a `/`.
|
||||
revision (`str`, *optional*):
|
||||
The git revision to upload to.
|
||||
endpoint (`str`, *optional*):
|
||||
The Hub endpoint to send the request to. Defaults to the value of `HF_ENDPOINT`.
|
||||
headers (`dict`, *optional*):
|
||||
Additional headers to include in the request
|
||||
transfers (`list`, *optional*):
|
||||
|
|
@ -195,9 +200,9 @@ class CompletionPayloadT(TypedDict):
|
|||
def lfs_upload(
|
||||
operation: "CommitOperationAdd",
|
||||
lfs_batch_action: dict,
|
||||
token: Optional[str] = None,
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
endpoint: Optional[str] = None,
|
||||
token: str | None = None,
|
||||
headers: dict[str, str] | None = None,
|
||||
endpoint: str | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
Handles uploading a given object to the Hub with the LFS protocol.
|
||||
|
|
@ -210,8 +215,14 @@ def lfs_upload(
|
|||
lfs_batch_action (`dict`):
|
||||
Upload instructions from the LFS batch endpoint for this object. See [`~utils.lfs.post_lfs_batch_info`] for
|
||||
more details.
|
||||
token (`str`, *optional*):
|
||||
An authentication token (see https://huggingface.co/settings/token). Used to call the
|
||||
optional LFS verify step at the end of the upload. If `None`, falls back to the local
|
||||
cached token.
|
||||
headers (`dict`, *optional*):
|
||||
Headers to include in the request, including authentication and user agent headers.
|
||||
endpoint (`str`, *optional*):
|
||||
The Hub endpoint to send the request to. Defaults to the value of `HF_ENDPOINT`.
|
||||
|
||||
Raises:
|
||||
[`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue