Skip to content

Commit

Permalink
installation for koboldcpp - WebUi (Recommended)
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsi123 committed Jan 11, 2025
1 parent ecdba06 commit 988d991
Show file tree
Hide file tree
Showing 7 changed files with 529 additions and 190 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
app 2/characters/.png
app 2/characters/uploaded_character/uploaded_character.png
/characters
venv/
93 changes: 33 additions & 60 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions app 2/imagecaption.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ def predict(model, image_array):
def get_sorted_general_strings(image_or_path, model_repo=None, hf_token=HF_TOKEN, general_threshold=0.35):
global model, tags_df, target_size

# Check if image_or_path is None
if image_or_path is None:
logger.error("Received None as image_or_path. Please provide a valid image or path.")
return None

try:
model, tags_df, target_size = load_model(model_repo, hf_token)
except ValueError:
Expand Down
49 changes: 49 additions & 0 deletions install windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@echo off
setlocal EnableDelayedExpansion

:: Check if virtual environment already exists
if not exist "venv\Scripts\activate.bat" (
echo Creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo Failed to create virtual environment
pause
exit /b 1
)
)

:: Activate virtual environment
call venv\Scripts\activate.bat

:: Upgrade pip
echo Upgrading pip...
python -m pip install --upgrade pip
if errorlevel 1 (
echo Failed to upgrade pip
pause
exit /b 1
)

:: Install requirements from requirements.txt
if exist requirements.txt (
echo Installing or upgrading requirements from requirements.txt...
pip install -r requirements.txt --use-deprecated=legacy-resolver --no-cache-dir --ignore-installed
if errorlevel 1 (
echo Failed to install some packages from requirements.txt, but continuing...
)
) else (
echo WARNING: requirements.txt not found!
)

:: Verify Python executable path and installed packages
where python
pip list

:: Installation complete
echo ========================================================
echo Installation complete!
echo Virtual environment created at: venv
echo Python packages installed successfully.
echo ========================================================
pause
endlocal
113 changes: 113 additions & 0 deletions install windows.bat~
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
@echo off
setlocal enabledelayedexpansion

:: Display warning and ask for confirmation
echo ========================================================
echo WARNING: This script will perform the following actions:
echo 1. Create a virtual environment in the current directory.
echo 2. Install Python packages, including PyTorch, Gradio, NumPy, Pandas, and Diffusers.
echo ========================================================
echo.
setlocal enabledelayedexpansion
set /p CONFIRM="Do you want to continue? (y/n): "
if /i "!CONFIRM!" neq "y" (
echo Installation canceled.
pause
exit /b 0
)


:: Create virtual environment and install requirements if it doesn't exist
if not exist "venv\Scripts\activate.bat" (
echo Creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo Failed to create virtual environment
pause
exit /b 1
)

:: Activate virtual environment
call venv\Scripts\activate.bat

:: Upgrade pip first
echo Upgrading pip...
python -m pip install --upgrade pip
if errorlevel 1 (
echo Failed to upgrade pip
pause
exit /b 1
)

:: Install wheel and setuptools first
echo Installing wheel and setuptools...
pip install --upgrade wheel setuptools --no-cache-dir
if errorlevel 1 (
echo Failed to install wheel and setuptools
pause
exit /b 1
)

:: Install torch separately first (if it's in requirements)
if exist requirements.txt (
findstr /i "torch" requirements.txt >nul
if errorlevel 0 (
echo Installing PyTorch first...
pip install torch torchvision torchaudio --no-cache-dir
if errorlevel 1 (
echo Failed to install PyTorch
pause
exit /b 1
)
)
)

:: Install requirements (First Pass)
echo Installing requirements (First Pass)...
if exist requirements.txt (
pip install -r requirements.txt --no-cache-dir --ignore-installed
if errorlevel 1 (
echo Some packages failed to install during the first pass. Continuing to the second pass...
)
) else (
echo WARNING: requirements.txt not found!
)

:: Install requirements (Second Pass)
echo Installing requirements (Second Pass)...
if exist requirements.txt (
pip install -r requirements.txt --no-cache-dir --ignore-installed
if errorlevel 1 (
echo Some packages failed to install during the second pass. Continuing anyway...
)
) else (
echo WARNING: requirements.txt not found!
)

:: Install critical packages explicitly
echo Installing critical packages...
pip install gradio numpy pandas diffusers --no-cache-dir
if errorlevel 1 (
echo Failed to install critical packages
pause
exit /b 1
)
) else (
:: Just activate the existing virtual environment
call venv\Scripts\activate.bat
)

:: Verify Python executable path
where python

:: Verify installed packages
pip list

:: Installation complete
echo ========================================================
echo Installation complete!
echo Virtual environment created at: venv
echo Python packages installed successfully.
echo ========================================================
pause
endlocal
Loading

0 comments on commit 988d991

Please sign in to comment.