hfutils.operate.upload
upload_file_to_file
- hfutils.operate.upload.upload_file_to_file(local_file, repo_id: str, file_in_repo: str, repo_type: Literal['dataset', 'model', 'space'] = 'dataset', revision: str = 'main', message: str | None = None)[source]
Upload a local file to a specified path in a Hugging Face repository.
- Parameters:
local_file (str) – The local file path to be uploaded.
repo_id (str) – The identifier of the repository.
file_in_repo (str) – The file path within the repository.
repo_type (RepoTypeTyping) – The type of the repository (‘dataset’, ‘model’, ‘space’).
revision (str) – The revision of the repository (e.g., branch, tag, commit hash).
message (Optional[str]) – The commit message for the upload.
upload_directory_as_archive
- hfutils.operate.upload.upload_directory_as_archive(local_directory, repo_id: str, archive_in_repo: str, repo_type: Literal['dataset', 'model', 'space'] = 'dataset', revision: str = 'main', message: str | None = None, silent: bool = False)[source]
Upload a local directory as an archive file to a specified path in a Hugging Face repository.
- Parameters:
local_directory (str) – The local directory path to be uploaded.
repo_id (str) – The identifier of the repository.
archive_in_repo (str) – The archive file path within the repository.
repo_type (RepoTypeTyping) – The type of the repository (‘dataset’, ‘model’, ‘space’).
revision (str) – The revision of the repository (e.g., branch, tag, commit hash).
message (Optional[str]) – The commit message for the upload.
silent (bool) – If True, suppress progress bar output.
upload_directory_as_directory
- hfutils.operate.upload.upload_directory_as_directory(local_directory, repo_id: str, path_in_repo: str, repo_type: ~typing.Literal['dataset', 'model', 'space'] = 'dataset', revision: str = 'main', message: str | None = None, time_suffix: bool = True, clear: bool = False, ignore_patterns: ~typing.List[str] = <object object>)[source]
Upload a local directory and its files to a specified path in a Hugging Face repository.
- Parameters:
local_directory (str) – The local directory path to be uploaded.
repo_id (str) – The identifier of the repository.
path_in_repo (str) – The directory path within the repository.
repo_type (RepoTypeTyping) – The type of the repository (‘dataset’, ‘model’, ‘space’).
revision (str) – The revision of the repository (e.g., branch, tag, commit hash).
message (Optional[str]) – The commit message for the upload.
time_suffix (bool) – If True, append a timestamp to the commit message.
clear (bool) – If True, remove files in the repository not present in the local directory.
ignore_patterns (List[str]) – List of file patterns to ignore.