Unsloth Studioをインストーラーを使わずに自分の用意したパイソン環境にインストールする

Unsloth Studio :オープンモデルの学習、実行、エクスポートを1つの統合された ローカル インターフェースで行える、オープンソースのノーコードWeb UIです。

準備

CMake

CMake – Upgrade Your Software Build System

Node.js

https://nodejs.org/ja

Visual Studio Build Tools

https://visualstudio.microsoft.com/ja/visual-cpp-build-tools

手順

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
pip install unsloth
unsloth studio setup
unsloth studio -H 127.0.0.1 -p 8888          

Node.jsが複数ある場合はwhereコマンドで確認ができます

where Node

“D:\WinPython\n\node.exe"

バッチファイル

仮想環境に

@echo off
call %~dp0\scripts\env_for_icons.bat  %*
SET PATH=%PATH%;%WINPYDIRBASE%\PortableGit;%WINPYDIRBASE%\PortableGit\bin
SET PATH=%PATH%;%WINPYDIRBASE%\ffmpeg\bin
If not exist %WINPYDIRBASE%\content mkdir  %WINPYDIRBASE%\content 

set HF_HOME=E:\my_cache\hf_home
set TRANSFORMERS_CACHE=E:\my_cache\transformers
set DIFFUSERS_CACHE=E:\my_cache\diffusers
echo HF_HOME = %HF_HOME%
echo TRANSFORMERS_CACHE = %TRANSFORMERS_CACHE%
echo DIFFUSERS_CACHE = %DIFFUSERS_CACHE%


set APP_NAME=unsloth
set APP_DIR=%WINPYDIRBASE%\content\%APP_NAME%
echo %APP_DIR%
cd %WINPYDIRBASE%\content\

If not exist  %APP_DIR% md %APP_DIR% 

cd %APP_DIR%
if not defined VENV_DIR (set "VENV_DIR=%APP_DIR%\venv")
if EXIST %VENV_DIR% goto :activate_venv

::python.exe -m venv "%VENV_DIR%" 
python.exe -m venv "%VENV_DIR%" --system-site-packages 
if %ERRORLEVEL% == 0 goto :pip
echo Unable to create venv 
goto :skip_venv

:pip
call "%VENV_DIR%\Scripts\activate"
pip install unsloth
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"

unsloth studio setup
::choco install nodejs --version="24.14.0"

cmd.exe /k

:activate_venv
call "%VENV_DIR%\Scripts\activate"
::
unsloth studio -H 127.0.0.1 -p 8888  
goto :skip_venv
:skip_cmd
::
:skip_venv
::
cmd.exe /k
 timeout /t 55
 

Python

Posted by eightban