p-doom/crowd-code-dataset-0.2 huggingface dataset:
[tab] slurm/jobs/franz/berlin/coinrun/mila_submission/50M_dataset/speed_ablations/batch_size_248/coinrun_dynamics_grain_ablation.sh (shellscript)
#!/usr/bin/env bash

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

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

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

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

tags="coinrun dynamics 50m_dataset mila_submission speed_test batch_size_248 ablation grain_ablation unicorn"

npy_files_dir="" # TODO dataset dir
tokenizer_ckpt_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29949"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM


srun python jasmine/train_dynamics.py \
    --patch_size=16 \
    --batch_size=248 \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags ${tags} \
    --entity instant-uv \
    --project jafar \
    --num_steps=100_000 \
    --log_interval=10_000 \
    --log_image_interval=200_000 \
    --tokenizer_checkpoint="${tokenizer_ckpt_dir}" \
    --data_dir="${npy_files_dir}/train" &

child_pid=$!

wait $child_pid
[tab] data/jasmine_data/ViZDoomPPO/explore_dataset.py (python)
import matplotlib.pyplot as plt
import base64
import io
from PIL import Image
import numpy as np
from matplotlib.animation import FuncAnimation
import pyarrow.parquet as pq


# Example script to open the parquet file and get the data
parquet_path = "./concatenated.parquet"
table = pq.read_table(parquet_path)
# Convert to pandas DataFrame
df = table.to_pandas()

# Sort by step_id
df_sorted = df.sort_values('step_id')

# Get the first row
first_row = df_sorted.iloc[27]

# Function to decode base64 image
def decode_image(b64_string):
    image_data = base64.b64decode(b64_string)
    return np.array(Image.open(io.BytesIO(image_data)))

# Decode all images in the first row
images = [decode_image(img) for img in first_row['images']]

# Create figure and axis
fig, ax = plt.subplots(figsize=(10, 8))
plt.axis('off')

# Animation function
def animate(i):
    ax.clear()
    ax.imshow(images[i])
    ax.set_title(f"Episode {first_row['episode_id']}, Step {first_row['step_id']}, Frame {i+1}/{len(images)}")
    ax.axis('off')

# Create animation
anim = FuncAnimation(fig, animate, frames=len(images), interval=200, repeat=True)

plt.show()

# Print other information about the first row
print(f"Episode ID: {first_row['episode_id']}")
print(f"Step ID: {first_row['step_id']}")
print(f"Health: {first_row['health']}")
print(f"Actions: {first_row['actions']}")
[tab] data/jasmine_data/ViZDoomPPO/requirements.txt (pip-requirements)
absl-py==2.1.0
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aiosignal==1.3.1
ale-py==0.9.0
appnope==0.1.4
asttokens==2.4.1
async-timeout==4.0.3
attrs==24.2.0
AutoROM==0.4.2
AutoROM.accept-rom-license==0.6.1
black==24.8.0
box2d-py==2.3.5
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
comm==0.2.2
contourpy==1.3.0
cramjam==2.8.3
cycler==0.12.1
Cython==3.0.11
datasets==3.0.0
debugpy==1.8.5
decorator==4.4.2
dill==0.3.8
exceptiongroup==1.2.2
executing==2.1.0
Farama-Notifications==0.0.4
fasteners==0.19
fastparquet==2024.5.0
filelock==3.16.0
fonttools==4.53.1
frozenlist==1.4.1
fsspec==2024.6.1
glfw==2.7.0
grpcio==1.66.1
gym==0.26.2
gym-notices==0.0.8
gymnasium==0.29.1
huggingface-hub==0.24.7
idna==3.8
imageio==2.35.1
imageio-ffmpeg==0.5.1
importlib_metadata==8.5.0
importlib_resources==6.4.5
iniconfig==2.0.0
ipykernel==6.29.5
ipython==8.18.1
ipywidgets==8.1.5
jedi==0.19.1
Jinja2==3.1.4
jupyter_client==8.6.2
jupyter_core==5.7.2
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
lz4==4.3.3
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdurl==0.1.2
moviepy==1.0.3
mpmath==1.3.0
mujoco==3.2.5
mujoco-py
multidict==6.1.0
multiprocess==0.70.16
mypy-extensions==1.0.0
nest-asyncio==1.6.0
networkx==3.2.1
numpy==2.0.2
opencv-python==4.10.0.84
packaging==24.1
pandas==2.2.2
parso==0.8.4
pathspec==0.12.1
pexpect==4.9.0
pillow==10.4.0
platformdirs==4.3.2
pluggy==1.5.0
proglog==0.1.10
prompt_toolkit==3.0.47
protobuf==5.28.1
psutil==6.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
py==1.11.0
pyarrow==17.0.0
pycparser==2.22
pygame>=2.1.0
Pygments==2.18.0
PyOpenGL==3.1.7
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2024.2
PyYAML==6.0.2
pyzmq==26.2.0
requests==2.32.3
rich==13.8.1
Shimmy==1.3.0
six==1.16.0
stable_baselines3==2.3.2
stack-data==0.6.3
swig==4.2.1
sympy==1.13.2
tensorboard==2.17.1
tensorboard-data-server==0.7.2
tomli==2.0.1
torch==2.4.1
tornado==6.4.1
tqdm==4.66.5
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
vizdoom==1.2.4
wcwidth==0.2.13
Werkzeug==3.0.4
widgetsnbextension==4.0.13
xxhash==3.5.0
yarl==1.11.1
zipp==3.20.1
imageio