File size: 457 Bytes
d3166c0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | """Find a local folder or a Hugging Face repo that holds Mini's files."""
from pathlib import Path
def resolve_pretrained_folder(path_or_repo):
"""Return a directory with config.json. Download a Hub repo id first."""
folder = Path(path_or_repo)
if folder.is_dir():
return folder
from huggingface_hub import snapshot_download
downloaded = snapshot_download(repo_id=str(path_or_repo))
return Path(downloaded)
|