-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.bat
More file actions
113 lines (95 loc) · 2.95 KB
/
setup.bat
File metadata and controls
113 lines (95 loc) · 2.95 KB
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
107
108
109
110
111
112
113
@echo off
setlocal enabledelayedexpansion
rem Set base directory to location of this script
set "BASE_DIR=%cd%\"
echo [1/6] Creating virtual environment...
python -m venv "%BASE_DIR%venv"
if errorlevel 1 (
echo Failed to create virtual environment. Aborting.
exit /b 1
)
echo [2/6] Activating virtual environment...
call "%BASE_DIR%venv\Scripts\activate"
if errorlevel 1 (
echo Failed to activate virtual environment. Aborting.
exit /b 1
)
echo [3/6] Upgrading pip...
python -m pip install --upgrade pip
if errorlevel 1 (
echo Failed to upgrade pip. Aborting.
exit /b 1
)
echo [4/6] Cloning LLaMA-Factory...
if exist "%BASE_DIR%LLaMA-Factory" (
echo LLaMA-Factory directory already exists. Skipping clone...
) else (
git clone https://github.com/hiyouga/LLaMA-Factory.git "%BASE_DIR%LLaMA-Factory"
if errorlevel 1 (
echo Failed to clone LLaMA-Factory. Aborting.
exit /b 1
)
)
echo [5/6] Installing LLaMA-Factory dependencies...
pip install -r "%BASE_DIR%LLaMA-Factory\requirements.txt"
if errorlevel 1 (
echo Failed to install LLaMA-Factory dependencies. Aborting.
exit /b 1
)
echo [6/6] Patching dataset_info.json with chat_sharegpt entry...
set "INFO_FILE=%BASE_DIR%LLaMA-Factory\data\dataset_info.json"
:: Exit if file is missing
if not exist "%INFO_FILE%" (
echo dataset_info.json not found at %INFO_FILE%
exit /b 1
)
:: Check if already patched
findstr /C:"\"chat_sharegpt\"" "%INFO_FILE%" >nul
if not errorlevel 1 (
echo chat_sharegpt entry already exists. Skipping patch.
goto :eof
)
:: Patch file
powershell -Command ^
"$path = '%INFO_FILE%';" ^
"$lines = Get-Content $path;" ^
"$lines = $lines[0..($lines.Count - 3)];" ^
"$lines += ' },';" ^
"$lines += ' \"chat_sharegpt\": {';" ^
"$lines += ' \"file_name\": \"../../data/chat_sharegpt.json\",';" ^
"$lines += ' \"formatting\": \"sharegpt\",';" ^
"$lines += ' \"columns\": {';" ^
"$lines += ' \"messages\": \"conversations\"';" ^
"$lines += ' },';" ^
"$lines += ' \"tags\": {';" ^
"$lines += ' \"role_tag\": \"from\",';" ^
"$lines += ' \"content_tag\": \"value\",';" ^
"$lines += ' \"user_tag\": \"user\",';" ^
"$lines += ' \"assistant_tag\": \"assistant\"';" ^
"$lines += ' }';" ^
"$lines += ' }';" ^
"$lines += '}';" ^
"Set-Content -Path $path -Value $lines"
if errorlevel 1 (
echo Failed to patch dataset_info.json
exit /b 1
)
echo dataset_info.json patched successfully.
echo.
echo 🧠 Running Telegram export processors...
python "%BASE_DIR%scripts\telegram_extract.py"
if errorlevel 1 (
echo Failed to run telegram_extract.py. Aborting.
exit /b 1
)
python "%BASE_DIR%scripts\convert_to_sharegpt.py"
if errorlevel 1 (
echo Failed to run convert_to_sharegpt.py. Aborting.
exit /b 1
)
echo.
echo All steps completed successfully.
echo.
echo Please refer to the README.md for the next steps.
echo You will find instructions on how to launch training.
pause