add localtunnel fallback (+1 squashed commits)

Squashed commits:

[ff0a63f6] add localtunnel fallback
This commit is contained in:
Concedo 2025-03-26 17:26:30 +08:00
parent ea358369cc
commit 75e7902789

View file

@ -73,8 +73,12 @@
"WavTokModel = \"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\" #@param [\"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\"]{allow-input: true}\n", "WavTokModel = \"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\" #@param [\"https://huggingface.co/koboldcpp/tts/resolve/main/WavTokenizer-Large-75-Q4_0.gguf\"]{allow-input: true}\n",
"TTSCommand = \"\"\n", "TTSCommand = \"\"\n",
"#@markdown <hr>\n", "#@markdown <hr>\n",
"#@markdown This enables saving stories directly to your google drive. You will have to grant permissions, and then you can access the saves from the \"KoboldCpp Server Storage\" option.\n",
"AllowSaveToGoogleDrive = False #@param {type:\"boolean\"}\n", "AllowSaveToGoogleDrive = False #@param {type:\"boolean\"}\n",
"SavGdriveCommand = \"\"\n", "SavGdriveCommand = \"\"\n",
"#@markdown <hr>\n",
"#@markdown Only select the following box if regular cloudflare tunnel fails to work. It will generate an inferior localtunnel tunnel, which you can use after entering a password.\n",
"MakeLocalTunnelFallback = False #@param {type:\"boolean\"}\n",
"\n", "\n",
"import os\n", "import os\n",
"if not os.path.isfile(\"/opt/bin/nvidia-smi\"):\n", "if not os.path.isfile(\"/opt/bin/nvidia-smi\"):\n",
@ -148,6 +152,19 @@
"if TTSCommand:\n", "if TTSCommand:\n",
" !aria2c -x 10 -o ttsmodel.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $TTSModel\n", " !aria2c -x 10 -o ttsmodel.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $TTSModel\n",
" !aria2c -x 10 -o ttswavtok.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $WavTokModel\n", " !aria2c -x 10 -o ttswavtok.bin --summary-interval=5 --download-result=default --allow-overwrite=true --file-allocation=none $WavTokModel\n",
"\n",
"if MakeLocalTunnelFallback:\n",
" import urllib\n",
" print(\"Trying to use LocalTunnel as a fallback tunnel (not so good)...\")\n",
" ltpw = urllib.request.urlopen('https://loca.lt/mytunnelpassword').read().decode('utf8').strip(\"\\n\")\n",
" !nohup npx --yes localtunnel --port 5001 > lt.log 2>&1 &\n",
" !sleep 8\n",
" print(\"=================\")\n",
" print(\"(LocalTunnel Results)\")\n",
" !cat lt.log\n",
" print(f\"Please open the above link, and input the password '{ltpw}'\\nYour KoboldCpp will start shortly...\")\n",
" print(\"=================\")\n",
" !sleep 10\n",
"!./koboldcpp_linux model.gguf --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand $SavGdriveCommand\n" "!./koboldcpp_linux model.gguf --usecublas 0 mmq --chatcompletionsadapter AutoGuess --multiuser --gpulayers $Layers --contextsize $ContextSize --websearch --quiet --remotetunnel $FACommand $MPCommand $VCommand $SCommand $WCommand $TTSCommand $SavGdriveCommand\n"
] ]
} }