Skip to content

Commit

Permalink
update download cell and setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoinky3000 committed Jun 29, 2024
1 parent 866e036 commit bcd2f5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions assets/build/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ apt install -y git \
curl \
wget > /dev/null

echo Installing Jupyter Lab...
pip install jupyterlab "huggingface_hub[hf_transfer]" > /dev/null
echo Installing necessary python packages...
pip install jupyterlab "huggingface_hub[hf_transfer]" humanize > /dev/null
12 changes: 11 additions & 1 deletion assets/workspace/SD Next.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,22 @@
"from urllib.parse import urlsplit\n",
"import requests\n",
"from huggingface_hub import hf_hub_download\n",
"import humanize\n",
"import time\n",
"\n",
"for dl in HUGGINGFACE_LIST:\n",
" repo, filePath = dl[:2]\n",
" dest = f'{dl[2] if len(dl) == 3 else \"./\"}'\n",
" print(f'\\n\\nDownloading \"{os.path.basename(filePath)}\" from \"{repo}\" to {os.path.join(dest, filePath)}...')\n",
" resultPath = os.path.join(dest, filePath)\n",
" print(f'\\n\\nDownloading \"{os.path.basename(filePath)}\" from \"{repo}\" to {resultPath}...')\n",
" start = time.time()\n",
" hf_hub_download(repo_id=repo, filename=filePath, local_dir=dest)\n",
" end = time.time()\n",
" timeUsed = end - start\n",
" fileSize = os.path.getsize(resultPath)\n",
" avgSpeed = humanize.naturalsize(fileSize/timeUsed, binary=True)\n",
" fileSize = humanize.naturalsize(fileSize, binary=True)\n",
" print(f'Download completed\\n- Time used: {timeUsed}s\\n- File size: {fileSize}\\n- Average speed: {avgSpeed}/s')\n",
"\n",
"for dl in DOWNLOAD_LIST:\n",
" baseLink = dl[0]\n",
Expand Down

0 comments on commit bcd2f5e

Please sign in to comment.