p-doom/crowd-code-dataset-0.2 huggingface dataset:
[content] sample.py (python)
def _oneshot_sample(rng, video_batch, action_batch):
    # Only provide the first frame as context, mask the rest
    # Prepare a batch with the first frame and the correct shape for the rest
    B, T, H, W, C = video_batch.shape
    # Use only the first frame as input, pad the rest with zeros (or any value, since they will be masked)
    input_videos = np.zeros_like(video_batch)
    input_videos[:, 0] = video_batch[:, 0]
    # Prepare the input dict for Genie
    batch = dict(
        videos=input_videos,
        mask_rng=rng,  # mask_rng is required by the model, but mask_limit=1 will mask everything except the first
    )
    # Forward pass (no iterative sampling)
    outputs = genie.apply(params, batch, False)
    return outputs["recon"]
[tab] scripts_horeka/overfit_sample_tiny/sample.sh (shellscript)
#!/usr/bin/env bash

# Unload modules that may interfere
module unload mpi/openmpi/5.0
module unload devel/cuda/12.4

# Activate virtual environment
source .venv/bin/activate

# Set workspace and checkpoint directory (update slurm_job_id as needed)
ws_dir='/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared'
# Replace the following with the actual job id/checkpoint you want to sample from
slurm_job_id=3301029

# job_name=train_dynamics_minecraft_overfit_sample_tiny
CHECKPOINT_DIR=$ws_dir/checkpoints/${slurm_job_id}

# Example: If you want to use a specific checkpoint, set it here
# CHECKPOINT_PATH=$ws_dir/checkpoints/3299272/dynamics-tiny-overfit-big-lr-3299272_50000/
# Or use the latest in the directory
# CHECKPOINT_PATH=$(ls -d $CHECKPOINT_DIR/*/ | sort | tail -n 1)
CHECKPOINT_PATH=$CHECKPOINT_DIR/genie_1751067601_200000/
CHECKPOINT_PATH=/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/checkpoints/0000/genie_1751301068_2000/
echo "Sampling from checkpoint: $CHECKPOINT_PATH"

python sample.py \
    --checkpoint "$CHECKPOINT_PATH" \
    --tokenizer_dim=384 \
    --latent_patch_dim=32 \
    --num_patch_latents=1024 \
    --patch_size=4 \
    --tokenizer_num_blocks=8 \
    --tokenizer_num_heads=8 \
    --lam_dim=384 \
    --latent_action_dim=32 \
    --num_latent_actions=6 \
    --lam_patch_size=16 \
    --lam_num_blocks=8 \
    --lam_num_heads=8 \
    --dyna_dim=128 \
    --dyna_num_blocks=2 \
    --dyna_num_heads=4 \
    --maskgit_steps=1 \
    --num_latent_actions=1 \
    --seq_len=3
[content] sample.py (python)
def _oneshot_sample(rng, video_batch, action_batch):
    # Pass the full video batch, as in training
    batch = dict(
        videos=video_batch,  # full batch, not just first frame
        latent_actions=action_batch,  # shape should match what was used in training
        mask_rng=rng,
    )
    outputs = genie.apply(params, batch, False)  # training=False for eval
    return outputs["recon"]
[tab] scripts_horeka/train_lam.sh (shellscript)
#!/usr/bin/env bash

module unload mpi/openmpi/5.0
module unload devel/cuda/12.4
source .venv/bin/activate


tf_records_dir=$ws_dir/knoms_tfrecords_500_shards
ws_dir='/hkfs/work/workspace/scratch/tum_ind3695-jafa_ws_shared/'

job_name="debug"
slurm_job_id="0000"

CHECKPOINT_DIR=$ws_dir/checkpoints/$job_name/$slurm_job_id
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

python train_lam.py \
    --ckpt_dir $CHECKPOINT_DIR \
    --batch_size=1 \
    --min_lr=3e-4 \
    --max_lr=3e-4 \
    --warmup_steps=125 \
    --log_image_interval=100 \
    --log \
    --log_checkpoint_interval=5 \
    --name=lam-tiny-overfit-$slurm_job_id \
    --tags lam overfit tiny \
    --entity instant-uv \
    --project jafar \
    --data_dir $tf_records_dir \
    --model_dim=384 \
    --latent_dim=32 \
    --num_latents=6 \
    --patch_size=16 \
    --num_blocks=8 \
    --num_heads=8 \
    --codebook_dropout=0.0 \
    --num_latents=1 \