Saksham Adhikari commited on
Commit
bb38358
·
1 Parent(s): 4047578

Add Dockerfile and startup script for HF Space

Browse files
Files changed (2) hide show
  1. Dockerfile +16 -0
  2. startup.sh +32 -0
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Start from a PyTorch + CUDA base image
2
+ FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
3
+
4
+ WORKDIR /code
5
+ COPY . .
6
+
7
+ # Install dependencies
8
+ RUN pip install -r requirements.txt
9
+ RUN pip install flash-attn --no-build-isolation
10
+
11
+ # Make the startup script executable
12
+ COPY startup.sh .
13
+ RUN chmod +x startup.sh
14
+
15
+ # This is the new command: it runs your script automatically when the Space starts.
16
+ CMD ["./startup.sh"]
startup.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # This script automates the setup and training process for the HRM fine-tuning.
3
+ # The 'set -e' command ensures that the script will exit immediately if any command fails.
4
+ set -e
5
+
6
+ echo "--- Starting Automated Finetuning Workflow ---"
7
+
8
+ # Step 1: Login to WandB using the secret
9
+ # Make sure you have your WANDB_API_KEY set in the Space secrets
10
+ wandb login $WANDB_API_KEY
11
+ echo "Step 1 complete: Logged into WandB."
12
+
13
+ # Step 2: Run the data curation and processing scripts
14
+ # (Assuming your curation and processing scripts are in the repo)
15
+ # python dataset_curation.py
16
+ # python dataset/build_abstract_dataset.py
17
+ echo "Step 2 complete: Data processing finished."
18
+
19
+ # Step 3: Launch the training job
20
+ echo "--- LAUNCHING TRAINING ---"
21
+ OMP_NUM_THREADS=8 python pretrain.py \
22
+ data_path=data/abstract_optimizer_processed \
23
+ arch=hrm_abstract_optimizer \
24
+ epochs=20000 \
25
+ global_batch_size=32 \
26
+ eval_interval=1000
27
+
28
+ echo "--- TRAINING COMPLETE ---"
29
+
30
+ # Step 4: Keep the space running after the script finishes (optional)
31
+ # echo "Workflow finished. Idling..."
32
+ # sleep infinity