hfutils.operate.validate

is_local_file_ready

hfutils.operate.validate.is_local_file_ready(local_file: str, repo_id: str, file_in_repo: str, repo_type: Literal['dataset', 'model', 'space'] = 'dataset', revision: str = 'main', hf_token: str | None = None) bool[source]

Checks if the local file is ready by comparing it with the file on the Hugging Face Hub repository.

Parameters:
  • local_file (str) – The path to the local file.

  • repo_id (str) – The identifier of the repository.

  • file_in_repo (str) – The path to the file in the repository.

  • repo_type (RepoTypeTyping) – The type of the repository. Default is ‘dataset’.

  • revision (str) – The revision of the repository. Default is ‘main’.

  • hf_token (Optional[str]) – The Hugging Face API token. Default is None.

Returns:

True if the local file matches the file on the repository, False otherwise.

Return type:

bool