Upgrading huggingface-hub 0.4 to 0.5
Breaking0.4.0 → 0.5.1Breaking2Platform1Deprecated2New9Changed5Fixed6Other23
BreakingUpgrade verdict
2 breaking changes and a platform requirement change.
In plain terms
- Two old ways of listing repository files are gone; use model_info and dataset_info instead.
- Renames the environment variable HF_ENDPOINT.
- Python 3.6 is no longer supported, so users on it will get the older v0.4.0 release.
- Deprecates positional args in file_download and hf_api.
Must act 5 items need code or config changes
Python requirement changed in 0.5.0: >=3.6.0 → >=3.7.0.
What you must change
Breaking2
Removes the deprecated list_repos_objs method and the huggingface-cli repo ls-files command.
list_repos_objshuggingface-cli repo ls-filesmodel_infodataset_infoRenames the environment variable HF_ENDPOINT.
HF_ENDPOINTPlatform1
Drops Python 3.6 support; installing on Python 3.6 resolves to version v0.4.0.
Deprecations to plan for
Deprecated2
Deprecates positional args in file_download and hf_api.
file_downloadhf_apiDeprecates name and organization in favor of repo_id.
nameorganizationrepo_idAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- removed:
export list_repos_objs - added:
export move_repo - added:
export set_access_token - added:
export unset_access_token
- removed:
class ListReposObjsCommand(BaseUserCommand) - removed:
method ListReposObjsCommand.run()
- added:
variable REPO_TYPE_MODEL
- changed:
function cached_download(url: str, library_name: Optional[str]=…, library_version: Optional[str]=…, cache_dir: Union[str, Path, None]=…, user_agent: Union[Dict, str, None]=…, force_download=…, force_filename: Optional[str]=…, proxies=…, etag_timeout=…, resume_download=…, use_auth_token: Union[bool, str, None]=…, local_files_only=…) -> Optional[str] → function cached_download(url: str, *, library_name: Optional[str]=…, library_version: Optional[str]=…, cache_dir: Union[str, Path, None]=…, user_agent: Union[Dict, str, None]=…, force_download: Optional[bool]=…, force_filename: Optional[str]=…, proxies: Optional[Dict]=…, etag_timeout: Optional[float]=…, resume_download: Optional[bool]=…, use_auth_token: Union[bool, str, None]=…, local_files_only:… - changed:
function hf_hub_download(repo_id: str, filename: str, subfolder: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, library_name: Optional[str]=…, library_version: Optional[str]=…, cache_dir: Union[str, Path, None]=…, user_agent: Union[Dict, str, None]=…, force_download=…, force_filename: Optional[str]=…, proxies=…, etag_timeout=…, resume_download=…, use_auth_token: Union[boo… → function hf_hub_download(repo_id: str, filename: str, *, subfolder: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, library_name: Optional[str]=…, library_version: Optional[str]=…, cache_dir: Union[str, Path, None]=…, user_agent: Union[Dict, str, None]=…, force_download: Optional[bool]=…, force_filename: Optional[str]=…, proxies: Optional[Dict]=…, etag_timeout: Optional[fl… - changed:
function hf_hub_url(repo_id: str, filename: str, subfolder: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…) -> str → function hf_hub_url(repo_id: str, filename: str, *, subfolder: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…) -> str - changed:
function http_get(url: str, temp_file: BinaryIO, proxies=…, resume_size=…, headers: Optional[Dict[str, str]]=…, timeout=…, max_retries=…) → function http_get(url: str, temp_file: BinaryIO, *, proxies=…, resume_size=…, headers: Optional[Dict[str, str]]=…, timeout=…, max_retries=…) - changed:
function http_user_agent(library_name: Optional[str]=…, library_version: Optional[str]=…, user_agent: Union[Dict, str, None]=…) -> str → function http_user_agent(*, library_name: Optional[str]=…, library_version: Optional[str]=…, user_agent: Union[Dict, str, None]=…) -> str - added:
function is_graphviz_available() - added:
function is_pydot_available()
- removed:
method HfApi.list_repos_objs(token: Optional[str]=…, organization: Optional[str]=…) -> List[RepoObj] - removed:
variable REMOTE_FILEPATH_REGEX - removed:
variable list_repos_objs - changed:
constructor DatasetInfo(id: Optional[str]=…, lastModified: Optional[str]=…, tags: List[str]=…, siblings: Optional[List[Dict]]=…, private: Optional[bool]=…, author: Optional[str]=…, description: Optional[str]=…, citation: Optional[str]=…, cardData: Optional[dict]=…, **kwargs) → constructor DatasetInfo(*, id: Optional[str]=…, lastModified: Optional[str]=…, tags: List[str]=…, siblings: Optional[List[Dict]]=…, private: Optional[bool]=…, author: Optional[str]=…, description: Optional[str]=…, citation: Optional[str]=…, cardData: Optional[dict]=…, **kwargs) - changed:
constructor MetricInfo(id: Optional[str]=…, description: Optional[str]=…, citation: Optional[str]=…, **kwargs) → constructor MetricInfo(*, id: Optional[str]=…, description: Optional[str]=…, citation: Optional[str]=…, **kwargs) - changed:
constructor ModelInfo(modelId: Optional[str]=…, sha: Optional[str]=…, lastModified: Optional[str]=…, tags: List[str]=…, pipeline_tag: Optional[str]=…, siblings: Optional[List[Dict]]=…, config: Optional[Dict]=…, **kwargs) → constructor ModelInfo(*, modelId: Optional[str]=…, sha: Optional[str]=…, lastModified: Optional[str]=…, tags: List[str]=…, pipeline_tag: Optional[str]=…, siblings: Optional[List[Dict]]=…, config: Optional[Dict]=…, **kwargs) - changed:
function repo_type_and_id_from_hf_id(hf_id: str) → function repo_type_and_id_from_hf_id(hf_id: str, hub_url: Optional[str]=…) - changed:
method HfApi.create_repo(name: str, token: Optional[str]=…, organization: Optional[str]=…, private: Optional[bool]=…, repo_type: Optional[str]=…, exist_ok=…, lfsmultipartthresh: Optional[int]=…, space_sdk: Optional[str]=…) -> str → method HfApi.create_repo(repo_id: str=…, *, token: Optional[str]=…, organization: Optional[str]=…, private: Optional[bool]=…, repo_type: Optional[str]=…, exist_ok: Optional[bool]=…, space_sdk: Optional[str]=…, name: Optional[str]=…) -> str - changed:
method HfApi.dataset_info(repo_id: str, revision: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…) -> DatasetInfo → method HfApi.dataset_info(repo_id: str, *, revision: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…) -> DatasetInfo - changed:
method HfApi.delete_file(path_in_repo: str, repo_id: str, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…) → method HfApi.delete_file(path_in_repo: str, repo_id: str, *, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…) - changed:
method HfApi.delete_repo(name: str, token: Optional[str]=…, organization: Optional[str]=…, repo_type: Optional[str]=…) → method HfApi.delete_repo(repo_id: str=…, *, token: Optional[str]=…, organization: Optional[str]=…, repo_type: Optional[str]=…, name: str=…) - changed:
method HfApi.get_full_repo_name(model_id: str, organization: Optional[str]=…, token: Optional[str]=…) → method HfApi.get_full_repo_name(model_id: str, *, organization: Optional[str]=…, token: Optional[str]=…) - changed:
method HfApi.list_datasets(filter: Union[DatasetFilter, str, Iterable[str], None]=…, author: Optional[str]=…, search: Optional[str]=…, sort: Union[Literal['lastModified'], str, None]=…, direction: Optional[Literal[-1]]=…, limit: Optional[int]=…, full: Optional[bool]=…) -> List[DatasetInfo] → method HfApi.list_datasets(*, filter: Union[DatasetFilter, str, Iterable[str], None]=…, author: Optional[str]=…, search: Optional[str]=…, sort: Union[Literal['lastModified'], str, None]=…, direction: Optional[Literal[-1]]=…, limit: Optional[int]=…, cardData: Optional[bool]=…, full: Optional[bool]=…, use_auth_token: Optional[str]=…) -> List[DatasetInfo] - changed:
method HfApi.list_models(filter: Union[ModelFilter, str, Iterable[str], None]=…, author: Optional[str]=…, search: Optional[str]=…, sort: Union[Literal['lastModified'], str, None]=…, direction: Optional[Literal[-1]]=…, limit: Optional[int]=…, full: Optional[bool]=…, fetch_config: Optional[bool]=…) -> List[ModelInfo] → method HfApi.list_models(*, filter: Union[ModelFilter, str, Iterable[str], None]=…, author: Optional[str]=…, search: Optional[str]=…, emissions_thresholds: Optional[Tuple[float, float]]=…, sort: Union[Literal['lastModified'], str, None]=…, direction: Optional[Literal[-1]]=…, limit: Optional[int]=…, full: Optional[bool]=…, cardData: Optional[bool]=…, fetch_config: Optional[bool]=…, use_auth_token:… - changed:
method HfApi.list_repo_files(repo_id: str, revision: Optional[str]=…, repo_type: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…) -> List[str] → method HfApi.list_repo_files(repo_id: str, *, revision: Optional[str]=…, repo_type: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…) -> List[str] - changed:
method HfApi.model_info(repo_id: str, revision: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…) -> ModelInfo → method HfApi.model_info(repo_id: str, *, revision: Optional[str]=…, token: Optional[str]=…, timeout: Optional[float]=…, securityStatus: Optional[bool]=…) -> ModelInfo - changed:
method HfApi.update_repo_visibility(name: str, private: bool, token: Optional[str]=…, organization: Optional[str]=…, repo_type: Optional[str]=…) -> Dict[str, bool] → method HfApi.update_repo_visibility(repo_id: str=…, private: bool=…, *, token: Optional[str]=…, organization: Optional[str]=…, repo_type: Optional[str]=…, name: str=…) -> Dict[str, bool] - changed:
method HfApi.upload_file(path_or_fileobj: Union[str, bytes, IO], path_in_repo: str, repo_id: str, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, identical_ok: bool=…) -> str → method HfApi.upload_file(*, path_or_fileobj: Union[str, bytes, IO], path_in_repo: str, repo_id: str, token: Optional[str]=…, repo_type: Optional[str]=…, revision: Optional[str]=…, identical_ok: bool=…) -> str - added:
method HfApi.move_repo(from_id: str, to_id: str, *, repo_type: Optional[str]=…, token: Optional[str]=…) - added:
variable logger - added:
variable move_repo - added:
variable set_access_token - added:
variable unset_access_token
- changed:
static method ModelHubMixin.from_pretrained(pretrained_model_name_or_path: Optional[str], force_download: bool=…, resume_download: bool=…, proxies: Dict=…, use_auth_token: Optional[str]=…, cache_dir: Optional[str]=…, local_files_only: bool=…, **model_kwargs) → static method ModelHubMixin.from_pretrained(pretrained_model_name_or_path: str, force_download: bool=…, resume_download: bool=…, proxies: Dict=…, use_auth_token: Optional[str]=…, cache_dir: Optional[str]=…, local_files_only: bool=…, **model_kwargs)
- changed:
function push_to_hub_keras(model, repo_path_or_name: Optional[str]=…, repo_url: Optional[str]=…, commit_message: Optional[str]=…, organization: Optional[str]=…, private: Optional[bool]=…, api_endpoint: Optional[str]=…, use_auth_token: Optional[Union[bool, str]]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, config: Optional[dict]=…) → function push_to_hub_keras(model, repo_path_or_name: Optional[str]=…, repo_url: Optional[str]=…, log_dir: Optional[str]=…, commit_message: Optional[str]=…, organization: Optional[str]=…, private: Optional[bool]=…, api_endpoint: Optional[str]=…, use_auth_token: Optional[Union[bool, str]]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, config: Optional[dict]=…, include_optimizer: Optional… - changed:
function save_pretrained_keras(model, save_directory: str, config: Optional[Dict[str, Any]]=…) → function save_pretrained_keras(model, save_directory: str, config: Optional[Dict[str, Any]]=…, include_optimizer: Optional[bool]=…, plot_model: Optional[bool]=…, task_name: Optional[str]=…, **model_save_kwargs)
- removed:
function lfs_log_progress() - removed:
property Repository.current_branch - changed:
constructor Repository(local_dir: str, clone_from: Optional[str]=…, repo_type: Optional[str]=…, use_auth_token: Union[bool, str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, revision: Optional[str]=…, private: bool=…, skip_lfs_files: bool=…) → constructor Repository(local_dir: str, clone_from: Optional[str]=…, repo_type: Optional[str]=…, use_auth_token: Union[bool, str]=…, git_user: Optional[str]=…, git_email: Optional[str]=…, revision: Optional[str]=…, private: bool=…, skip_lfs_files: bool=…, client: Optional[HfApi]=…) - added:
property Repository.current_branch -> str
- changed:
function snapshot_download(repo_id: str, revision: Optional[str]=…, cache_dir: Union[str, Path, None]=…, library_name: Optional[str]=…, library_version: Optional[str]=…, user_agent: Optional[Union[Dict, str]]=…, proxies=…, etag_timeout=…, resume_download=…, use_auth_token: Optional[Union[bool, str]]=…, local_files_only=…, allow_regex: Optional[Union[List[str], str]]=…, ignore_regex: Optional[Unio… → function snapshot_download(repo_id: str, *, revision: Optional[str]=…, cache_dir: Union[str, Path, None]=…, library_name: Optional[str]=…, library_version: Optional[str]=…, user_agent: Optional[Union[Dict, str]]=…, proxies: Optional[Dict]=…, etag_timeout: Optional[float]=…, resume_download: Optional[bool]=…, use_auth_token: Optional[Union[bool, str]]=…, local_files_only: Optional[bool]=…, allow_r…