Colab fixes

This commit is contained in:
oobabooga 2023-10-22 08:57:16 -07:00
parent c544f5cc51
commit 994502d41b

View File

@ -78,7 +78,7 @@
" !pip install -r extensions/api/requirements.txt --upgrade\n",
" !pip install -r temp_requirements.txt --upgrade\n",
"\n",
" print(\"\\033[1;32;1m\\n --> If you see a warning about \\\"previously imported packages\\\", just ignore it.\\n\\033[0;37;0m\")",
" print(\"\\033[1;32;1m\\n --> If you see a warning about \\\"previously imported packages\\\", just ignore it.\\033[0;37;0m\")\n",
" print(\"\\033[1;32;1m\\n --> There is no need to restart the runtime.\\n\\033[0;37;0m\")\n",
"\n",
" try:\n",
@ -98,21 +98,27 @@
" command_line_flags += f\" {param}\"\n",
"\n",
"model_url = model_url.strip()\n",
"if not model_url.startswith('http'):\n",
"if model_url != \"\":\n",
" if not model_url.startswith('http'):\n",
" model_url = 'https://huggingface.co/' + model_url\n",
"\n",
"# Download the model\n",
"url_parts = model_url.strip('/').strip().split('/')\n",
"output_folder = f\"{url_parts[-2]}_{url_parts[-1]}\"\n",
"branch = branch.strip('\"\\' ')\n",
"if branch.strip() != '':\n",
" # Download the model\n",
" url_parts = model_url.strip('/').strip().split('/')\n",
" output_folder = f\"{url_parts[-2]}_{url_parts[-1]}\"\n",
" branch = branch.strip('\"\\' ')\n",
" if branch.strip() != '':\n",
" output_folder += f\"_{branch}\"\n",
" !python download-model.py {model_url} --branch {branch}\n",
"else:\n",
" else:\n",
" !python download-model.py {model_url}\n",
"else:\n",
" output_folder = \"\"\n",
"\n",
"# Start the web UI\n",
"cmd = f\"python server.py --share --model {output_folder} {command_line_flags}\"\n",
"cmd = f\"python server.py --share\"\n",
"if output_folder != \"\":\n",
" cmd += f\" --model {output_folder}\"\n",
"cmd += f\" {command_line_flags}\"\n",
"print(cmd)\n",
"!$cmd"
],