Skip to content

Commit

Permalink
add support for sub directories downloading (#31)
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
samos123 authored Aug 19, 2023
1 parent e69e901 commit fd6310e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions model-loader-huggingface/src/load.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
],
"source": [
"import urllib.request\n",
"from pathlib import Path\n",
"from huggingface_hub import hf_hub_url\n",
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
"\n",
Expand All @@ -157,6 +158,7 @@
" destination = f\"{output_dir}/{filename}\"\n",
" print(f\"Downloading {filename} to {destination}\")\n",
" url = hf_hub_url(model_id, filename)\n",
" Path(destination).parent.mkdir(exist_ok=True, parents=True)\n",
" urllib.request.urlretrieve(url, destination)\n",
" return destination\n",
"\n",
Expand Down

0 comments on commit fd6310e

Please sign in to comment.