-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_act.bat
More file actions
328 lines (308 loc) · 7.96 KB
/
Copy pathtrain_act.bat
File metadata and controls
328 lines (308 loc) · 7.96 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
@echo off
REM train_act.bat - Batch script for training ACT models on Windows
REM
REM Usage:
REM train_act.bat --dataset-root lerobot_datasets\001 --steps 20000
REM train_act.bat --preset quick --dataset-root lerobot_datasets\001
REM train_act.bat --help
setlocal enabledelayedexpansion
REM Default values
set "DATASET_ROOT="
set "OUTPUT_DIR="
set "STEPS=20000"
set "BATCH_SIZE=8"
set "DEVICE=cuda"
set "LEARNING_RATE=1e-5"
set "CHUNK_SIZE=100"
set "VISION_BACKBONE=resnet18"
set "USE_VAE=true"
set "SEED=1000"
set "USE_AMP=false"
set "USE_STANDALONE=false"
set "LEROBOT_ROOT="
set "PRESET="
REM Parse arguments
:parse_args
if "%~1"=="" goto check_args
if "%~1"=="--dataset-root" (
set "DATASET_ROOT=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--output-dir" (
set "OUTPUT_DIR=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--steps" (
set "STEPS=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--batch-size" (
set "BATCH_SIZE=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--learning-rate" (
set "LEARNING_RATE=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--seed" (
set "SEED=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--device" (
set "DEVICE=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--chunk-size" (
set "CHUNK_SIZE=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--vision-backbone" (
set "VISION_BACKBONE=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--lerobot-root" (
set "LEROBOT_ROOT=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--preset" (
set "PRESET=%~2"
shift
shift
goto parse_args
)
if "%~1"=="--use-amp" (
set "USE_AMP=true"
shift
goto parse_args
)
if "%~1"=="--no-amp" (
set "USE_AMP=false"
shift
goto parse_args
)
if "%~1"=="--no-vae" (
set "USE_VAE=false"
shift
goto parse_args
)
if "%~1"=="--standalone" (
set "USE_STANDALONE=true"
shift
goto parse_args
)
if "%~1"=="--help" (
goto show_help
)
if "%~1"=="-h" (
goto show_help
)
echo Error: Unknown option %~1
echo Use --help for usage information
exit /b 1
:check_args
if "!DATASET_ROOT!"=="" (
echo Error: Missing required argument: --dataset-root
echo Use --help for usage information
exit /b 1
)
if not exist "!DATASET_ROOT!" (
echo Error: Dataset root not found: !DATASET_ROOT!
exit /b 1
)
if not exist "!DATASET_ROOT!\meta\info.json" (
echo Error: Dataset metadata not found: !DATASET_ROOT!\meta\info.json
echo Make sure to run: python main.py convert dataset_name
exit /b 1
)
REM Apply preset if specified
if not "!PRESET!"=="" (
call :apply_preset !PRESET!
)
REM Print configuration
echo.
echo [INFO] Training Configuration:
echo Dataset: !DATASET_ROOT!
if not "!OUTPUT_DIR!"=="" (
echo Output dir: !OUTPUT_DIR!
)
echo Steps: !STEPS!
echo Batch size: !BATCH_SIZE!
echo Device: !DEVICE!
echo Learning rate: !LEARNING_RATE!
echo Seed: !SEED!
echo.
echo [INFO] ACT Configuration:
echo Chunk size: !CHUNK_SIZE!
echo Vision backbone: !VISION_BACKBONE!
echo Use VAE: !USE_VAE!
echo Use AMP: !USE_AMP!
if not "!LEROBOT_ROOT!"=="" (
echo LeRobot root: !LEROBOT_ROOT!
)
echo.
echo [INFO] Script Settings:
echo Use standalone: !USE_STANDALONE!
if not "!PRESET!"=="" (
echo Preset: !PRESET!
)
echo.
REM Build command
set "CMD="
if "!USE_STANDALONE!"=="true" (
set "CMD=python train_act_standalone.py"
) else (
set "CMD=python main.py train --model-type act"
)
set "CMD=!CMD! --dataset-root !DATASET_ROOT!"
set "CMD=!CMD! --steps !STEPS!"
set "CMD=!CMD! --batch-size !BATCH_SIZE!"
set "CMD=!CMD! --learning-rate !LEARNING_RATE!"
set "CMD=!CMD! --seed !SEED!"
set "CMD=!CMD! --device !DEVICE!"
set "CMD=!CMD! --chunk-size !CHUNK_SIZE!"
set "CMD=!CMD! --vision-backbone !VISION_BACKBONE!"
if not "!OUTPUT_DIR!"=="" (
set "CMD=!CMD! --output-dir !OUTPUT_DIR!"
)
if "!USE_AMP!"=="true" (
set "CMD=!CMD! --use-amp"
)
if "!USE_VAE!"=="false" (
set "CMD=!CMD! --no-vae"
)
if not "!LEROBOT_ROOT!"=="" (
set "CMD=!CMD! --lerobot-root !LEROBOT_ROOT!"
)
echo [SUCCESS] Starting ACT training...
echo.
REM Execute command
%CMD%
if %errorlevel% equ 0 (
echo.
echo [SUCCESS] Training completed successfully!
if not "!OUTPUT_DIR!"=="" (
echo Output directory: !OUTPUT_DIR!
) else (
for %%F in (!DATASET_ROOT!) do (
echo Output directory: outputs\%%~nxF_act
)
)
) else (
echo.
echo [ERROR] Training failed with exit code %errorlevel%
exit /b %errorlevel%
)
goto :eof
REM Apply preset configuration
:apply_preset
if "%~1"=="quick" (
set "BATCH_SIZE=16"
set "STEPS=5000"
set "CHUNK_SIZE=50"
set "VISION_BACKBONE=resnet18"
set "USE_AMP=true"
echo [INFO] Applied preset: quick (batch=16, steps=5000, backbone=resnet18)
) else if "%~1"=="balanced" (
set "BATCH_SIZE=8"
set "STEPS=20000"
set "CHUNK_SIZE=75"
set "VISION_BACKBONE=resnet18"
echo [INFO] Applied preset: balanced (batch=8, steps=20000, backbone=resnet18)
) else if "%~1"=="production" (
set "BATCH_SIZE=8"
set "STEPS=50000"
set "CHUNK_SIZE=100"
set "VISION_BACKBONE=resnet50"
set "SEED=42"
echo [INFO] Applied preset: production (batch=8, steps=50000, backbone=resnet50)
) else if "%~1"=="limited-vram" (
set "BATCH_SIZE=2"
set "STEPS=10000"
set "CHUNK_SIZE=50"
set "VISION_BACKBONE=resnet18"
set "USE_AMP=true"
echo [INFO] Applied preset: limited-vram (batch=2, steps=10000, amp=enabled)
) else (
echo Error: Unknown preset: %~1
echo Available presets: quick, balanced, production, limited-vram
exit /b 1
)
goto :eof
:show_help
echo.
echo ACT Model Training Script for Windows
echo.
echo Usage:
echo train_act.bat --dataset-root PATH [options]
echo train_act.bat --preset PRESET_NAME --dataset-root PATH
echo.
echo Required Arguments:
echo --dataset-root PATH Path to LeRobotDataset v3 directory
echo.
echo Preset Options:
echo --preset quick Quick experiment (5-10 min, low quality)
echo --preset balanced Balanced (15-30 min, good quality)
echo --preset production Production (60+ min, high quality)
echo --preset limited-vram For GPUs with less than 8GB VRAM
echo.
echo Common Arguments:
echo --steps N Training steps (default: 20000)
echo --batch-size N Batch size (default: 8)
echo --learning-rate LR Learning rate (default: 1e-5)
echo --seed N Random seed (default: 1000)
echo --device DEVICE cuda^|cpu^|mps (default: cuda)
echo --output-dir PATH Output directory (auto-generated if omitted)
echo --lerobot-root PATH Path to lerobot repo (auto-detected if omitted)
echo.
echo ACT Architecture Arguments:
echo --chunk-size N Chunk size (default: 100)
echo --vision-backbone BACKBONE resnet18^|resnet34^|resnet50 (default: resnet18)
echo --no-vae Disable VAE
echo --use-amp Enable Automatic Mixed Precision
echo.
echo Script Options:
echo --standalone Use standalone script instead of main.py
echo --help Show this help message
echo.
echo Examples:
echo.
echo REM Quick test
echo train_act.bat --dataset-root lerobot_datasets\001 --steps 5000
echo.
echo REM Quick preset
echo train_act.bat --preset quick --dataset-root lerobot_datasets\001
echo.
echo REM Production quality
echo train_act.bat --preset production --dataset-root lerobot_datasets\001
echo.
echo REM Large model
echo train_act.bat --preset production --dataset-root lerobot_datasets\001 ^
echo --vision-backbone resnet50 --batch-size 4
echo.
echo REM Limited VRAM
echo train_act.bat --preset limited-vram --dataset-root lerobot_datasets\001
echo.
echo REM Standalone script
echo train_act.bat --standalone --dataset-root lerobot_datasets\001
echo.
exit /b 0