mirror of
https://github.com/mindverse/Second-Me.git
synced 2026-07-24 00:23:27 +00:00
* Add CUDA support - CUDA detection - Memory handling - Ollama model release after training * Fix logging issue added cuda support flag so log accurately reflected cuda toggle * Update llama.cpp rebuild Changed llama.cpp to only check if cuda support is enabled and if so rebuild during the first build rather than each run * Improved vram management Enabled memory pinning and optimizer state offload * Fix CUDA check rewrote llama.cpp rebuild logic, added manual y/n toggle if user wants to enable cuda support * Added fast restart and fixed CUDA check command Added make docker-restart-backend-fast to restart the backend and reflect code changes without causing a full llama.cpp rebuild Fixed make docker-check-cuda command to correctly reflect cuda support * Added docker-compose.gpu.yml Added docker-compose.gpu.yml to fix error on machines without nvidia gpu and made sure "\n" is added before .env modification * Fixed cuda toggle Last push accidentally broke cuda toggle * Code review fixes Fixed errors resulting from removed code: - Added return save_path to end of save_hf_model function - Rolled back download_file_with_progress function * Update Makefile Use cuda by default when using docker-restart-backend-fast * Minor cleanup Removed unnecessary makefile command and fixed gpu logging * Delete .gpu_selected * Simplified cuda training code - Removed dtype setting to let torch automatically handle it - Removed vram logging - Removed Unnecessary/old comments * Fixed gpu/cpu selection Made "make docker-use-gpu/cpu" command work with .gpu_selected flag and changed "make docker-restart-backend-fast" command to respect flag instead of always using gpu * Fix Ollama embedding error Added custom exception class for Ollama embeddings, which seemed to be returning keyword arguments while the Python exception class only accepts positional ones * Fixed model selection & memory error Fixed training defaulting to 0.5B model regardless of selection and fixed "free(): double free detected in tcache 2" error caused by cuda flag being passed incorrectly
69 lines
No EOL
2.1 KiB
Batchfile
69 lines
No EOL
2.1 KiB
Batchfile
@echo off
|
|
REM Script to prompt user for CUDA support preference
|
|
|
|
echo === CUDA Support Selection ===
|
|
echo.
|
|
echo Do you want to build with NVIDIA GPU (CUDA) support?
|
|
echo This requires an NVIDIA GPU and proper NVIDIA Docker runtime configuration.
|
|
echo.
|
|
set /p choice="Build with CUDA support? (y/n): "
|
|
|
|
if /i "%choice%"=="y" goto cuda
|
|
if /i "%choice%"=="yes" goto cuda
|
|
goto nocuda
|
|
|
|
:cuda
|
|
echo Selected: Build WITH CUDA support
|
|
|
|
REM Create or update .env file with the Dockerfile selection
|
|
if exist .env (
|
|
REM Check if variable already exists in file
|
|
findstr /c:"DOCKER_BACKEND_DOCKERFILE" .env >nul
|
|
if %ERRORLEVEL% EQU 0 (
|
|
REM Update existing variable
|
|
powershell -Command "(Get-Content .env) -replace '^DOCKER_BACKEND_DOCKERFILE=.*', 'DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda' | Set-Content .env"
|
|
) else (
|
|
REM Append to file with newline before
|
|
echo.>> .env
|
|
echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda>> .env
|
|
)
|
|
) else (
|
|
REM Create new file
|
|
echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda> .env
|
|
)
|
|
|
|
REM Create a flag file to indicate GPU use
|
|
echo GPU > .gpu_selected
|
|
|
|
echo Environment set to build with CUDA support
|
|
goto end
|
|
|
|
:nocuda
|
|
echo Selected: Build WITHOUT CUDA support (CPU only)
|
|
|
|
REM Create or update .env file with the Dockerfile selection
|
|
if exist .env (
|
|
REM Check if variable already exists in file
|
|
findstr /c:"DOCKER_BACKEND_DOCKERFILE" .env >nul
|
|
if %ERRORLEVEL% EQU 0 (
|
|
REM Update existing variable
|
|
powershell -Command "(Get-Content .env) -replace '^DOCKER_BACKEND_DOCKERFILE=.*', 'DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend' | Set-Content .env"
|
|
) else (
|
|
REM Append to file with newline before
|
|
echo.>> .env
|
|
echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend>> .env
|
|
)
|
|
) else (
|
|
REM Create new file
|
|
echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend> .env
|
|
)
|
|
|
|
REM Remove any GPU flag file if it exists
|
|
if exist .gpu_selected (
|
|
del .gpu_selected
|
|
)
|
|
|
|
echo Environment set to build without CUDA support
|
|
|
|
:end
|
|
echo === CUDA Selection Complete === |