-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAgentChef_install.bat
106 lines (94 loc) · 2.97 KB
/
AgentChef_install.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@echo off
setlocal enabledelayedexpansion
echo Starting AgentChef installation script
:: Set paths
set "CONDA_PATH=%USERPROFILE%\miniconda3\Scripts\conda.exe"
set "CONDA_ACTIVATE=%USERPROFILE%\miniconda3\Scripts\activate.bat"
:: Function to check if a command exists
:command_exists
where %1 >nul 2>nul
if %errorlevel% neq 0 (
exit /b 1
)
exit /b 0
:: Check if Miniconda is installed
call :command_exists conda
if %errorlevel% neq 0 (
echo Miniconda is not installed. Please install Miniconda and run this script again.
exit /b 1
)
:: Initialize conda for cmd
call %CONDA_PATH% init cmd
:: Check and install Node.js and npm if necessary
call :command_exists npm
if %errorlevel% neq 0 (
echo Node.js and npm not found. Please install Node.js from https://nodejs.org/
exit /b 1
)
:: Check and install Ollama if necessary
call :command_exists ollama
if %errorlevel% neq 0 (
echo Ollama not found. Please install Ollama from https://ollama.ai/
exit /b 1
)
:: Function to check AgentChef environment
:check_agentchef_env
%CONDA_PATH% info --envs | findstr /C:"AgentChef" >nul
if %errorlevel% neq 0 (
exit /b 1
)
%CONDA_PATH% run -n AgentChef python --version | findstr /C:"Python 3.11" >nul
if %errorlevel% neq 0 (
exit /b 1
)
exit /b 0
:: Set up AgentChef environment if necessary
call :check_agentchef_env
if %errorlevel% neq 0 (
echo AgentChef environment not found or incomplete. Setting up AgentChef...
%CONDA_PATH% create --name AgentChef python=3.11 -y
call %CONDA_ACTIVATE% AgentChef
%CONDA_PATH% install pytorch torchvision torchaudio cpuonly -c pytorch -y
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
pip install xformers
pip install --no-deps trl peft accelerate bitsandbytes
pip install flask flask-cors
echo AgentChef environment setup complete.
) else (
echo AgentChef environment found. Activating...
call %CONDA_ACTIVATE% AgentChef
)
:: Install Python requirements
echo Installing Python requirements...
if exist requirements.txt (
pip install -r requirements.txt
) else (
echo requirements.txt not found. Installing essential packages...
pip install flask flask-cors
)
:: Install npm packages
echo Installing npm packages...
if exist react-app (
cd react-app
if exist package.json (
echo Running npm install...
npm install
if %errorlevel% equ 0 (
echo Running npm audit fix...
npm audit fix
) else (
echo npm install failed. Please try running the following commands manually:
echo cd %CD%
echo npm install
echo npm audit fix
echo If issues persist, you may need to run: npm cache clean --force
)
) else (
echo package.json not found in react-app directory. Skipping npm package installation.
)
cd ..
) else (
echo react-app directory not found. Skipping npm package installation.
)
echo AgentChef installation completed.
endlocal