From 89883a399c6fc80ca2c811c9ac877593d462ad0f Mon Sep 17 00:00:00 2001 From: jfryton <35437877+jfryton@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:20:21 -0400 Subject: [PATCH 1/6] Create WSL.md guide for setting up WSL Ubuntu Quick start guide for Windows Subsystem for Linux (Ubuntu), including port forwarding to enable local network webui access. --- docs/WSL.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 docs/WSL.md diff --git a/docs/WSL.md b/docs/WSL.md new file mode 100644 index 0000000000..5c250de61e --- /dev/null +++ b/docs/WSL.md @@ -0,0 +1,71 @@ +# Windows Subsystem for Linux (Ubuntu) Installation Guide + +Here's an easy-to-follow, step-by-step guide for installing Windows Subsystem for Linux (WSL) with Ubuntu on Windows 10/11: + +## Step 1: Enable WSL + +1. Press the Windows key + X and click on "Windows PowerShell (Admin)" or "Windows Terminal (Admin)" to open PowerShell or Terminal with administrator privileges. +2. In the PowerShell window, type the following command and press Enter: + +``` +wsl --install +``` + +If this command doesn't work, you can enable WSL with the following command for Windows 10: + +``` +wsl --set-default-version 1 +``` + +For Windows 11, you can use: + +``` +wsl --set-default-version 2 +``` + +You may be prompted to restart your computer. If so, save your work and restart. + +## Step 2: Install Ubuntu + +1. Open the Microsoft Store. +2. Search for "Ubuntu" in the search bar. +3. Choose the desired Ubuntu version (e.g., Ubuntu 20.04 LTS) and click "Get" or "Install" to download and install the Ubuntu app. +4. Once the installation is complete, click "Launch" or search for "Ubuntu" in the Start menu and open the app. + +## Step 3: Set up Ubuntu + +1. When you first launch the Ubuntu app, it will take a few minutes to set up. Be patient as it installs the necessary files and sets up your environment. +2. Once the setup is complete, you will be prompted to create a new UNIX username and password. Choose a username and password, and make sure to remember them, as you will need them for future administrative tasks within the Ubuntu environment. + +## Step 4: Update and upgrade packages + +1. After setting up your username and password, it's a good idea to update and upgrade your Ubuntu system. Run the following commands in the Ubuntu terminal: + +``` +sudo apt update +sudo apt upgrade +``` + +2. Enter your password when prompted. This will update the package list and upgrade any outdated packages. + +Congratulations! You have now installed WSL with Ubuntu on your Windows 10/11 system. You can use the Ubuntu terminal for various tasks, like running Linux commands, installing packages, or managing files. + +You can launch your WSL Ubuntu installation by selecting the Ubuntu app (like any other program installed on your computer) or typing 'ubuntu' into Powershell or Terminal. + +## Step 5: Proceed with Linux instructions + +1. You can now follow the Linux setup instructions. If you receive any error messages about a missing tool or package, just install them using apt: + +``` +sudo apt install [missing package] +``` + +## Bonus: Port Forwarding + +By default, you won't be able to access the webui from another device on your local network. You will need to setup the appropriate port forwarding using the following command (using PowerShell or Terminal with administrator privileges). + +``` +netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=7860 connectaddress=localhost connectport=7860 +``` + +If you face any issues or need to troubleshoot, you can always refer to the official Microsoft documentation for WSL: https://docs.microsoft.com/en-us/windows/wsl/ From 055edc7fddfc83b5858e72590bed85af2e560010 Mon Sep 17 00:00:00 2001 From: jfryton <35437877+jfryton@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:21:14 -0400 Subject: [PATCH 2/6] Update WSL.md --- docs/WSL.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/WSL.md b/docs/WSL.md index 5c250de61e..8297e6bfd4 100644 --- a/docs/WSL.md +++ b/docs/WSL.md @@ -60,6 +60,8 @@ You can launch your WSL Ubuntu installation by selecting the Ubuntu app (like an sudo apt install [missing package] ``` +If you face any issues or need to troubleshoot, you can always refer to the official Microsoft documentation for WSL: https://docs.microsoft.com/en-us/windows/wsl/ + ## Bonus: Port Forwarding By default, you won't be able to access the webui from another device on your local network. You will need to setup the appropriate port forwarding using the following command (using PowerShell or Terminal with administrator privileges). @@ -68,4 +70,4 @@ By default, you won't be able to access the webui from another device on your lo netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=7860 connectaddress=localhost connectport=7860 ``` -If you face any issues or need to troubleshoot, you can always refer to the official Microsoft documentation for WSL: https://docs.microsoft.com/en-us/windows/wsl/ + From 09045e4bdbddeedb2d35378b647312c7de20b49e Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 15 Mar 2023 19:42:06 -0300 Subject: [PATCH 3/6] Add WSL guide --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c9834558bb..180c86291b 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,8 @@ conda install pytorch torchvision torchaudio git -c pytorch ``` > **Note** -> 1. If you are on Windows, it may be easier to run the commands above in a WSL environment. The performance may also be better. +> 1. If you are on Windows, it may be easier to run the commands above in a WSL environment. The performance may also be better. A full guide can be found here: [Windows Subsystem for Linux (Ubuntu) Installation Guide +](https://github.com/oobabooga/text-generation-webui/wiki/Windows-Subsystem-for-Linux-(Ubuntu)-Installation-Guide). > 2. For a more detailed, user-contributed guide, see: [Installation instructions for human beings](https://github.com/oobabooga/text-generation-webui/wiki/Installation-instructions-for-human-beings). ## Installation option 2: one-click installers From e9e76bb06cc3552b1e52984ec4f1682673102115 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 15 Mar 2023 19:42:29 -0300 Subject: [PATCH 4/6] Delete WSL.md --- docs/WSL.md | 73 ----------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 docs/WSL.md diff --git a/docs/WSL.md b/docs/WSL.md deleted file mode 100644 index 8297e6bfd4..0000000000 --- a/docs/WSL.md +++ /dev/null @@ -1,73 +0,0 @@ -# Windows Subsystem for Linux (Ubuntu) Installation Guide - -Here's an easy-to-follow, step-by-step guide for installing Windows Subsystem for Linux (WSL) with Ubuntu on Windows 10/11: - -## Step 1: Enable WSL - -1. Press the Windows key + X and click on "Windows PowerShell (Admin)" or "Windows Terminal (Admin)" to open PowerShell or Terminal with administrator privileges. -2. In the PowerShell window, type the following command and press Enter: - -``` -wsl --install -``` - -If this command doesn't work, you can enable WSL with the following command for Windows 10: - -``` -wsl --set-default-version 1 -``` - -For Windows 11, you can use: - -``` -wsl --set-default-version 2 -``` - -You may be prompted to restart your computer. If so, save your work and restart. - -## Step 2: Install Ubuntu - -1. Open the Microsoft Store. -2. Search for "Ubuntu" in the search bar. -3. Choose the desired Ubuntu version (e.g., Ubuntu 20.04 LTS) and click "Get" or "Install" to download and install the Ubuntu app. -4. Once the installation is complete, click "Launch" or search for "Ubuntu" in the Start menu and open the app. - -## Step 3: Set up Ubuntu - -1. When you first launch the Ubuntu app, it will take a few minutes to set up. Be patient as it installs the necessary files and sets up your environment. -2. Once the setup is complete, you will be prompted to create a new UNIX username and password. Choose a username and password, and make sure to remember them, as you will need them for future administrative tasks within the Ubuntu environment. - -## Step 4: Update and upgrade packages - -1. After setting up your username and password, it's a good idea to update and upgrade your Ubuntu system. Run the following commands in the Ubuntu terminal: - -``` -sudo apt update -sudo apt upgrade -``` - -2. Enter your password when prompted. This will update the package list and upgrade any outdated packages. - -Congratulations! You have now installed WSL with Ubuntu on your Windows 10/11 system. You can use the Ubuntu terminal for various tasks, like running Linux commands, installing packages, or managing files. - -You can launch your WSL Ubuntu installation by selecting the Ubuntu app (like any other program installed on your computer) or typing 'ubuntu' into Powershell or Terminal. - -## Step 5: Proceed with Linux instructions - -1. You can now follow the Linux setup instructions. If you receive any error messages about a missing tool or package, just install them using apt: - -``` -sudo apt install [missing package] -``` - -If you face any issues or need to troubleshoot, you can always refer to the official Microsoft documentation for WSL: https://docs.microsoft.com/en-us/windows/wsl/ - -## Bonus: Port Forwarding - -By default, you won't be able to access the webui from another device on your local network. You will need to setup the appropriate port forwarding using the following command (using PowerShell or Terminal with administrator privileges). - -``` -netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=7860 connectaddress=localhost connectport=7860 -``` - - From 0552ab2e9f879e296e6946244db0b7a5755b30ac Mon Sep 17 00:00:00 2001 From: awoo Date: Thu, 16 Mar 2023 02:00:16 +0300 Subject: [PATCH 5/6] flask_cloudflared for shared tunnels --- extensions/api/requirements.txt | 1 + extensions/api/script.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 extensions/api/requirements.txt diff --git a/extensions/api/requirements.txt b/extensions/api/requirements.txt new file mode 100644 index 0000000000..ad788ab8ad --- /dev/null +++ b/extensions/api/requirements.txt @@ -0,0 +1 @@ +flask_cloudflared==0.0.12 \ No newline at end of file diff --git a/extensions/api/script.py b/extensions/api/script.py index 3dbf6368fe..53e47f3fc8 100644 --- a/extensions/api/script.py +++ b/extensions/api/script.py @@ -75,7 +75,15 @@ def do_POST(self): def run_server(): server_addr = ('0.0.0.0' if shared.args.listen else '127.0.0.1', params['port']) server = ThreadingHTTPServer(server_addr, Handler) - print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api') + if shared.args.share: + try: + from flask_cloudflared import _run_cloudflared + public_url = _run_cloudflared(params['port'], params['port'] + 1) + print(f'Starting KoboldAI compatible api at {public_url}/api') + except ImportError: + print('You should install flask_cloudflared manually') + else: + print(f'Starting KoboldAI compatible api at http://{server_addr[0]}:{server_addr[1]}/api') server.serve_forever() def ui(): From 445ebf0ba80b7cf55e7f793ecfa6a9f3ed0f20aa Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:06:46 -0300 Subject: [PATCH 6/6] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 180c86291b..992d96eefa 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Open a terminal and copy and paste these commands one at a time ([install conda] ``` conda create -n textgen conda activate textgen -conda install torchvision torchaudio pytorch-cuda=11.7 git -c pytorch -c nvidia +conda install torchvision=0.14.1 torchaudio=0.13.1 pytorch-cuda=11.7 git -c pytorch -c nvidia git clone https://github.com/oobabooga/text-generation-webui cd text-generation-webui pip install -r requirements.txt @@ -51,13 +51,13 @@ The third line assumes that you have an NVIDIA GPU. * If you have an AMD GPU, replace the third command with this one: ``` -pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.2 +pip3 install torch torchvision=0.14.1 torchaudio=0.13.1 --extra-index-url https://download.pytorch.org/whl/rocm5.2 ``` * If you are running it in CPU mode, replace the third command with this one: ``` -conda install pytorch torchvision torchaudio git -c pytorch +conda install pytorch torchvision=0.14.1 torchaudio=0.13.1 git -c pytorch ``` > **Note**