updated code

This commit is contained in:
Saifeddine ALOUI 2023-09-27 21:23:47 +02:00
parent f320632c9f
commit f423326757
4 changed files with 50 additions and 20 deletions

3
app.py
View File

@ -793,7 +793,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.binding = BindingBuilder().build_binding(self.config, self.lollms_paths)
self.model = self.binding.build_model()
for per in self.mounted_personalities:
per.model = self.model
if per is not None:
per.model = self.model
except Exception as ex:
# Catch the exception and get the traceback as a list of strings
traceback_lines = traceback.format_exception(type(ex), ex, ex.__traceback__)

View File

@ -29,22 +29,39 @@ cd ~/lollms-webui
conda create --prefix ./env python=3.10 pip -y
conda activate ./env
# install cuda
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
# Add cuda to the path
export PATH=/usr/local/cuda/bin:$PATH
#make it permanant
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda-12.2/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH
#make it permanant
echo "export LD_LIBRARY_PATH=/usr/local/cuda-12.2/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH" >> ~/.bashrc
# Prompt the user for CPU or GPU installation
read -p "Do you want to use your CPU or GPU for installation? (CPU/GPU): " choice
if [[ "$choice" == "GPU" ]]; then
# Install CUDA (only if not already installed)
if ! dpkg -l | grep cuda; then
echo "Installing CUDA..."
# install cuda
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
# Add cuda to the path
export PATH=/usr/local/cuda/bin:$PATH
#make it permanant
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda-12.2/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH
#make it permanant
echo "export LD_LIBRARY_PATH=/usr/local/cuda-12.2/targets/x86_64-linux/lib/:$LD_LIBRARY_PATH" >> ~/.bashrc
else
echo "CUDA is already installed."
fi
else
# CPU installation
echo "Using CPU for installation..."
fi
# Install requirements
pip install -r requirements.txt
# by default ubuntu will start in lollms-webui path
echo 'cd ~/lollms-webui' >> ~/.bashrc
# Add automatic conda activate

View File

@ -39,7 +39,7 @@ WizardStyle=modern
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
Source: "{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion

View File

@ -1,10 +1,22 @@
@echo off
echo Checking if wsl is installed...
echo Checking if WSL is enabled...
wsl --list >nul 2>&1
if %errorlevel% neq 0 (
echo WSL is not enabled or installed. Enabling and installing...
echo WSL is not enabled. Enabling it...
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
echo WSL installation complete.
echo WSL is now enabled.
) else (
echo WSL is enabled and installed.
)
)
echo Checking if WSL 2 is installed...
wsl --set-default-version 2 >nul 2>&1
if %errorlevel% neq 0 (
echo WSL 2 is not installed. Installing it...
wsl --install
echo WSL 2 installation complete.
) else (
echo WSL 2 is already installed.
)
pause