Skip to content

Upgrading huggingface-hub 0.11 to 0.12

Breaking0.11.1 → 0.12.1Breaking6Security2New9Changed7Fixed11Other31

BreakingUpgrade verdict

6 breaking changes and 2 security fixes.

  • The function to read a Space's secrets has been removed.
  • Cloning a repository no longer creates it on the Hub automatically, and the private option is gone.
  • The regex filtering options for downloads are replaced by pattern-based options.
  • These helpers now only use the HTTP approach; the git-based code path is gone.
Top 5 of 8 that need code or config changes
Breaking6
Removes the get_space_secrets endpoint.
HfApi.get_space_secrets
Repository clone_from no longer creates the remote repository if it does not exist, and the private init argument is removed.
Repositoryclone_fromcreate_repoprivate
Removes allow_regex and ignore_regex from snapshot_download in favor of allow_patterns and ignore_patterns.
snapshot_downloadallow_regexignore_regexallow_patternsignore_patterns
Removes the git-based implementation of push_to_hub_fastai, ModelHubMixin, PyTorchModelHubMixin, push_to_hub_keras and KerasModelHubMixin in favor of the HTTP-based approach.
push_to_hub_fastaiModelHubMixinPyTorchModelHubMixinpush_to_hub_kerasKerasModelHubMixin
Removes code deprecated in v0.12.
create_repo and metadata_eval_result now require keyword arguments.
create_repometadata_eval_result
Security2
Removes the authorization header when following redirections in cached_download, matching the fix already applied to hf_hub_download.
cached_downloadhf_hub_download
Ensures the authorization header is never forwarded.

Generated by DepDelta from published Python source. Not mixed with prose notes.

  • added: export GitRefInfo
  • added: export GitRefs
  • added: export RepoUrl
  • added: export SpaceHardware
  • added: export SpaceRuntime
  • added: export SpaceStage
  • added: export UserLikes
  • added: export add_space_secret
  • added: export delete_space_secret
  • added: export get_space_runtime
  • added: export like
  • added: export list_liked_repos
  • added: export list_repo_refs
  • added: export request_space_hardware
  • added: export unlike
  • added: variable HF_HUB_ENABLE_HF_TRANSFER: bool
  • added: variable HF_TOKEN_PATH
  • changed: function push_to_hub_fastai(learner, *, repo_id: str, commit_message: str=…, private: bool=…, token: Optional[str]=…, config: Optional[dict]=…, branch: Optional[str]=…, create_pr: Optional[bool]=…, allow_patterns: Optional[Union[List[str], str]]=…, ignore_patterns: Optional[Union[List[str], str]]=…, api_endpoint: Optional[str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…) → function push_to_hub_fastai(learner, *, repo_id: str, commit_message: str=…, private: bool=…, token: Optional[str]=…, config: Optional[dict]=…, branch: Optional[str]=…, create_pr: Optional[bool]=…, allow_patterns: Optional[Union[List[str], str]]=…, ignore_patterns: Optional[Union[List[str], str]]=…, api_endpoint: Optional[str]=…)
  • changed: constructor HfApi(endpoint: Optional[str]=…, token: Optional[str]=…) -> None → constructor HfApi(endpoint: Optional[str]=…, token: Optional[str]=…, library_name: Optional[str]=…, library_version: Optional[str]=…, user_agent: Union[Dict, str, None]=…) -> None
  • changed: method HfApi.create_branch(repo_id: str, *, branch: str, token: Optional[str]=…, repo_type: Optional[str]=…) -> None → method HfApi.create_branch(repo_id: str, *, branch: str, revision: Optional[str]=…, token: Optional[str]=…, repo_type: Optional[str]=…, exist_ok: bool=…) -> None
  • changed: method HfApi.create_repo(repo_id: str, *, token: Optional[str]=…, private: bool=…, repo_type: Optional[str]=…, exist_ok: bool=…, space_sdk: Optional[str]=…) -> str → method HfApi.create_repo(repo_id: str, *, token: Optional[str]=…, private: bool=…, repo_type: Optional[str]=…, exist_ok: bool=…, space_sdk: Optional[str]=…, space_hardware: Optional[str]=…) -> RepoUrl
  • changed: method HfApi.create_tag(repo_id: str, *, tag: str, tag_message: Optional[str]=…, revision: Optional[str]=…, token: Optional[str]=…, repo_type: Optional[str]=…) -> None → method HfApi.create_tag(repo_id: str, *, tag: str, tag_message: Optional[str]=…, revision: Optional[str]=…, token: Optional[str]=…, repo_type: Optional[str]=…, exist_ok: bool=…) -> None
  • changed: method HfApi.upload_file(*, path_or_fileobj: Union[str, bytes, BinaryIO], path_in_repo: str, repo_id: str, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, commit_message: Optional[str]=…, commit_description: Optional[str]=…, create_pr: Optional[bool]=…, parent_commit: Optional[str]=…) -> str → method HfApi.upload_file(*, path_or_fileobj: Union[str, Path, bytes, BinaryIO], path_in_repo: str, repo_id: str, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, commit_message: Optional[str]=…, commit_description: Optional[str]=…, create_pr: Optional[bool]=…, parent_commit: Optional[str]=…) -> str
  • added: class GitRefInfo
  • added: class GitRefs
  • added: class RepoUrl(str)
  • added: class UserLikes
  • added: constructor GitRefInfo(data: Dict) -> None
  • added: constructor RepoUrl(url: Any, endpoint: Optional[str]=…) -> None
  • added: field GitRefInfo.name: str
  • added: field GitRefInfo.ref: str
  • added: field GitRefInfo.target_commit: str
  • added: field GitRefs.branches: List[GitRefInfo]
  • added: field GitRefs.converts: List[GitRefInfo]
  • added: field GitRefs.tags: List[GitRefInfo]
  • added: field UserLikes.datasets: List[str]
  • added: field UserLikes.models: List[str]
  • added: field UserLikes.spaces: List[str]
  • added: field UserLikes.total: int
  • added: field UserLikes.user: str
  • added: method HfApi.add_space_secret(repo_id: str, key: str, value: str, *, token: Optional[str]=…) -> None
  • added: method HfApi.delete_space_secret(repo_id: str, key: str, *, token: Optional[str]=…) -> None
  • added: method HfApi.get_space_runtime(repo_id: str, *, token: Optional[str]=…) -> SpaceRuntime
  • added: method HfApi.like(repo_id: str, *, token: Optional[str]=…, repo_type: Optional[str]=…) -> None
  • added: method HfApi.list_liked_repos(user: Optional[str]=…, *, token: Optional[str]=…) -> UserLikes
  • added: method HfApi.list_repo_refs(repo_id: str, *, repo_type: Optional[str]=…, token: Optional[Union[bool, str]]=…) -> GitRefs
  • added: method HfApi.request_space_hardware(repo_id: str, hardware: SpaceHardware, *, token: Optional[str]=…) -> None
  • added: method HfApi.unlike(repo_id: str, *, token: Optional[str]=…, repo_type: Optional[str]=…) -> None
  • added: variable add_space_secret
  • added: variable delete_space_secret
  • added: variable get_space_runtime
  • added: variable like
  • added: variable list_liked_repos
  • added: variable list_repo_refs
  • added: variable request_space_hardware
  • added: variable unlike
  • changed: method ModelHubMixin.push_to_hub(*, repo_path_or_name: Optional[str]=…, repo_url: Optional[str]=…, commit_message: str=…, organization: Optional[str]=…, private: bool=…, api_endpoint: Optional[str]=…, token: Optional[str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, config: Optional[dict]=…, skip_lfs_files: bool=…, repo_id: Optional[str]=…, branch: Optional[str]=…, create_pr: Optiona… → method ModelHubMixin.push_to_hub(repo_id: str, *, config: Optional[dict]=…, commit_message: str=…, private: bool=…, api_endpoint: Optional[str]=…, token: Optional[str]=…, branch: Optional[str]=…, create_pr: Optional[bool]=…, allow_patterns: Optional[Union[List[str], str]]=…, ignore_patterns: Optional[Union[List[str], str]]=…) -> str
  • changed: function push_to_hub_keras(model, *, repo_path_or_name: Optional[str]=…, repo_url: Optional[str]=…, log_dir: Optional[str]=…, commit_message: str=…, organization: Optional[str]=…, private: bool=…, api_endpoint: Optional[str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, config: Optional[dict]=…, include_optimizer: bool=…, tags: Optional[Union[list, str]]=…, plot_model: bool=…, token:… → function push_to_hub_keras(model, repo_id: str, *, config: Optional[dict]=…, commit_message: str=…, private: bool=…, api_endpoint: Optional[str]=…, token: Optional[str]=…, branch: Optional[str]=…, create_pr: Optional[bool]=…, allow_patterns: Optional[Union[List[str], str]]=…, ignore_patterns: Optional[Union[List[str], str]]=…, log_dir: Optional[str]=…, include_optimizer: bool=…, tags: Optional[Un…
  • added: property EvalResult.unique_identifier -> tuple
  • removed: property Repository.private -> bool
  • removed: property Repository.repo_type -> Optional[str]
  • changed: constructor Repository(local_dir: str, clone_from: Optional[str]=…, repo_type: Optional[str]=…, token: Union[bool, str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, revision: Optional[str]=…, private: bool=…, skip_lfs_files: bool=…, client: Optional[HfApi]=…) → constructor Repository(local_dir: Union[str, Path], clone_from: Optional[str]=…, repo_type: Optional[str]=…, token: Union[bool, str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, revision: Optional[str]=…, skip_lfs_files: bool=…, client: Optional[HfApi]=…)
  • added: export GatedRepoError
  • added: export SoftTemporaryDirectory
  • added: export get_hf_transfer_version
  • added: export get_pillow_version
  • added: export is_hf_transfer_available
  • added: export is_pillow_available
  • added: export tqdm_stream_file
  • removed: function iter_fileobj(fileobj: BinaryIO, chunk_size: Optional[int]=…) -> Iterable[bytes]
  • removed: function sha_iter(iterable: Iterable[bytes])
  • added: function tqdm_stream_file(path: Union[Path, str]) -> Iterator[io.BufferedReader]