p-doom/crowd-code-dataset-0.2 huggingface dataset:
[tab] slurm/dev/franz/helmholtz_cluster/coinrun/flash_attention_throughput_investigation/dynamics_1B_4096_seqlen_spatial_FA_temporal_XLA_max_bs.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/lustre/groups/haicu/workspace/franz.srambical/logs/coinrun/dynamics/%x_%j.log
#SBATCH --error=/lustre/groups/haicu/workspace/franz.srambical/logs/coinrun/dynamics/%x_%j.log
#SBATCH --job-name=train_dynamics_coinrun_flash_attention_throughput_investigation

# Log the sbatch script
cat $0

source .venv/bin/activate

array_records_dir="lustre/groups/haicu/workspace/alfred.nguyen/jafar_worksapce/data/coinrun_array_records_10M_new/"

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

CHECKPOINT_DIR="/lustre/groups/haicu/workspace/franz.srambical/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "ablation/flash-attn-only-spatial" ]; then
    echo "This script must be run from the ablation/flash-attn-only-spatial branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_dynamics.py \
    --ckpt_dir $CHECKPOINT_DIR \
    --save_ckpt \
    --log \
    --log_interval 10000 \
    --log_image_interval 10000 \
    --name=${job_name}_${slurm_job_id} \
    --tags flash_attention_throughput_investigation dynamics \
    --entity instant-uv \
    --project jafar \
    --data_dir $array_records_dir/train &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/helmholtz_cluster/coinrun/flash_attention_throughput_investigation/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/lustre/groups/haicu/workspace/franz.srambical/logs/coinrun/tokenizer/%x_%j.log
#SBATCH --error=/lustre/groups/haicu/workspace/franz.srambical/logs/coinrun/tokenizer/%x_%j.log
#SBATCH --job-name=train_tokenizer_coinrun_flash_attention_throughput_investigation

# Log the sbatch script
cat $0

source .venv/bin/activate

array_records_dir="/lustre/groups/haicu/workspace/alfred.nguyen/jafar_worksapce/data/coinrun_array_records_10M_new"

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

CHECKPOINT_DIR="/lustre/groups/haicu/workspace/franz.srambical/checkpoints/coinrun/tokenizer/${job_name}/${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "ablation/flash-attn-only-spatial" ]; then
    echo "This script must be run from the ablation/flash-attn-only-spatial branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --ckpt_dir $CHECKPOINT_DIR \
    --save_ckpt \
    --log \
    --name=${job_name}_${slurm_job_id} \
    --tags flash_attention_throughput_investigation tokenizer \
    --entity instant-uv \
    --project jafar \
    --log_checkpoint_interval 10 \
    --data_dir $array_records_dir/train &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/generate_parquet_dataset.sh (shellscript)
#!/bin/bash

set -uex

OUTPUT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/parquet/"
CSV_ROOT="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/csv/"

uv run crowd-pilot/serialize_dataset_parquet.py --csv_root=$CSV_ROOT --output_dir=$OUTPUT_DIR
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/generate_array_record_dataset.sh (shellscript)
#!/bin/bash

set -uex

OUTPUT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/"
CSV_ROOT="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/csv/"

uv run crowd-pilot/serialize_dataset_array_record.py --csv_root=$CSV_ROOT --output_dir=$OUTPUT_DIR
[content] slurm/dev/franz/helmholtz_cluster/crowd-pilot/generate_parquet_dataset.sh (shellscript)
OUTPUT_DIR="/lustre/groups/haicu/workspace/alfred.nguyen/jafar_worksapce/data/crowd-pilot/crowd-code-0.1/array_record/"
CSV_ROOT="/lustre/groups/haicu/workspace/alfred.nguyen/jafar_worksapce/data/crowd-pilot/crowd-code-0.1/csv/"
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/qwen-coder-small/download_checkpoint.sh (shellscript)
#!/usr/bin/env bash
set -uex

source .venv/bin/activate

MODEL_NAME="Qwen/Qwen3-Coder-30B-A3B-Instruct"
OUTPUT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/checkpoint_pretrained_hf/${MODEL_NAME}"

HF_HUB_ENABLE_HF_TRANSFER=1 hf download ${MODEL_NAME} --local-dir ${OUTPUT_DIR}
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/qwen-coder-small/convert_checkpoint.sh (shellscript)
#!/usr/bin/env bash
set -uex

export XLA_PJRT_GPU_HOST_MEMORY_LIMIT_GB=400
cd maxtext
source .venv/bin/activate

MODEL_NAME="Qwen/Qwen3-Coder-30B-A3B-Instruct"
HF_MODEL_PATH="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/checkpoint_pretrained_hf/${MODEL_NAME}"
OUTPUT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/checkpoint_pretrained_maxtext/${MODEL_NAME}"

python3 -m MaxText.convert_qwen3_moe\
  --base_model_path ${HF_MODEL_PATH}\
  --maxtext_model_path ${OUTPUT_DIR}\
  --model_size qwen3-30b-a3b \
  --simulated_cpu_devices_count=2
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/qwen-coder-small/train_10_epochs.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --job-name=crowd-pilot_maxtext_array_record_10_epochs
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# Log the sbatch script
cat $0

cd maxtext
source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID
BASE_OUTPUT_DIRECTORY=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/outputs/
GRAIN_TRAIN_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/train_*.array_record"
GRAIN_EVAL_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/val_*.array_record"

env | grep SLURM

# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  num_epoch=10 \
  skip_jax_distributed_system=True
[tab] slurm/dev/franz/helmholtz_cluster/crowd-pilot/qwen-coder-small/train.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:8
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --job-name=crowd-pilot_qwen3-30b-a3b_dev
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# Log the sbatch script
cat $0

cd maxtext
source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID
BASE_OUTPUT_DIRECTORY=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/outputs/
PRETRAINED_CHECKPOINT_PATH=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/checkpoint_pretrained_maxtext/Qwen/Qwen3-Coder-30B-A3B-Instruct/
GRAIN_TRAIN_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/train_*.array_record"
GRAIN_EVAL_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/val_*.array_record"

env | grep SLURM

# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  per_device_batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  skip_jax_distributed_system=True
[content] slurm/dev/franz/helmholtz_cluster/crowd-pilot/qwen-coder-small/train_10_epochs.sh (shellscript)
# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  per_device_batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  skip_jax_distributed_system=True
[tab] slurm/dev/franz/berlin/crowd-pilot/qwen-coder-small/train.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:8
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --job-name=crowd-pilot_qwen3-30b-a3b_dev
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# Log the sbatch script
cat $0

cd maxtext
source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID
BASE_OUTPUT_DIRECTORY=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/outputs/
PRETRAINED_CHECKPOINT_PATH=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/checkpoint_pretrained_maxtext/Qwen/Qwen3-Coder-30B-A3B-Instruct/
GRAIN_TRAIN_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/train_*.array_record"
GRAIN_EVAL_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/val_*.array_record"

env | grep SLURM

# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  per_device_batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  skip_jax_distributed_system=True
[tab] slurm/dev/franz/berlin/crowd-pilot/qwen-coder-small/train_10_epochs.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/crowd-pilot/maxtext/%x_%j.log
#SBATCH --job-name=crowd-pilot_maxtext_array_record_10_epochs
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# Log the sbatch script
cat $0

cd maxtext
source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID
BASE_OUTPUT_DIRECTORY=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/outputs/
GRAIN_TRAIN_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/train_*.array_record"
GRAIN_EVAL_FILES="/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/crowd-code-0.1/array_record/val_*.array_record"

env | grep SLURM

# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  num_epoch=10 \
  skip_jax_distributed_system=True
[content] slurm/dev/franz/berlin/crowd-pilot/qwen-coder-small/train_10_epochs.sh (shellscript)
# FIXME(f.srambical): change the batch size to the largest one that can fit in accelerator memory
python3 -m MaxText.train \
  MaxText/configs/base.yml \
  run_name=${job_name}_${slurm_job_id} \
  base_output_directory=$BASE_OUTPUT_DIRECTORY \
  load_parameters_path=$PRETRAINED_CHECKPOINT_PATH/0/items/ \
  model_name=qwen3-30b-a3b \
  max_target_length=8192 \
  eval_interval=500 \
  steps=25000 \
  per_device_batch_size=1 \
  tokenizer_type=huggingface \
  tokenizer_path=src/MaxText/assets/qwen3-tokenizer \
  dataset_type=grain \
  grain_file_type=arrayrecord \
  grain_train_files=$GRAIN_TRAIN_FILES \
  grain_eval_files=$GRAIN_EVAL_FILES \
  skip_jax_distributed_system=True