Checks whether a path likely refers to a Hugging Face repository.
(path: str)
| 187 | |
| 188 | |
| 189 | def is_hf_path(path: str) -> bool: |
| 190 | """Checks whether a path likely refers to a Hugging Face repository.""" |
| 191 | |
| 192 | # Match Transformers: Existing local paths take precedence over Hub lookup, |
| 193 | # even if the path string is also a valid repository ID. |
| 194 | if Path(path).exists(): |
| 195 | return False |
| 196 | |
| 197 | validate_repo_id(path) |
| 198 | return True |
| 199 | |
| 200 | |
| 201 | @dataclass |
no outgoing calls
no test coverage detected