p-doom/crowd-code-dataset-0.2 huggingface dataset:
[tab] slurm/dev/franz/berlin/crowd-pilot/qwen_0_6/vllm_decode.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_qwen3-0.6b_vllm_decode
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# Log the sbatch script
cat $0

cd maxtext
source .venv/bin/activate

HF_CHECKPOINT_PATH=/fast/project/HFMI_SynergyUnit/jafar_ws/data/crowd-pilot/outputs/hf_converted/qwen3-0.6b

SCRIPT_DIR="$(dirname "$0")"
PYTHON_SCRIPT="$SCRIPT_DIR/vllm_decode.py"

PROMPT_FILE="$SCRIPT_DIR/prompt.txt"

python3 "$PYTHON_SCRIPT" \
    --model_path "$HF_CHECKPOINT_PATH" \
    --prompt_file "$PROMPT_FILE" \
    --max_tokens 128 \
    --temperature 0.0 \
    --top_p 1.0 \
    --top_k 0 \
    --dtype float16
[tab] slurm/dev/franz/berlin/crowd-pilot/qwen_0_6/vllm_decode.py (python)
#!/usr/bin/env python3
"""
vLLM Decode Script for Hugging Face Models

This script loads a Hugging Face model and generates text using vLLM.
It reads the prompt from a file or uses a default prompt.
"""

import argparse
import os
import sys
from pathlib import Path

from vllm import LLM, SamplingParams


def load_prompt(prompt_file: str) -> str:
    """Load prompt from file or return default."""
    if os.path.exists(prompt_file):
        with open(prompt_file, 'r', encoding='utf-8') as f:
            return f.read().strip()
    return "Today is a beautiful day to"


def main():
    parser = argparse.ArgumentParser(description="Run vLLM inference on a Hugging Face model")
    parser.add_argument(
        "--model_path", 
        type=str, 
        required=True,
        help="Path to the Hugging Face model directory"
    )
    parser.add_argument(
        "--prompt_file", 
        type=str, 
        default="prompt.txt",
        help="Path to file containing the prompt (default: prompt.txt)"
    )
    parser.add_argument(
        "--prompt", 
        type=str, 
        help="Direct prompt text (overrides prompt_file if provided)"
    )
    parser.add_argument(
        "--max_tokens", 
        type=int, 
        default=128,
        help="Maximum tokens to generate (default: 128)"
    )
    parser.add_argument(
        "--temperature", 
        type=float, 
        default=0.0,
        help="Sampling temperature (default: 0.0)"
    )
    parser.add_argument(
        "--top_p", 
        type=float, 
        default=1.0,
        help="Top-p sampling (default: 1.0)"
    )
    parser.add_argument(
        "--top_k", 
        type=int, 
        default=0,
        help="Top-k sampling (default: 0)"
    )
    parser.add_argument(
        "--dtype", 
        type=str, 
        default="float16",
        help="Model dtype (default: float16)"
    )
    
    args = parser.parse_args()
    
    # Check if model path exists
    if not os.path.exists(args.model_path):
        print(f"Error: Model path does not exist: {args.model_path}", file=sys.stderr)
        sys.exit(1)
    
    # Get prompt
    if args.prompt:
        prompt = args.prompt
    else:
        prompt = load_prompt(args.prompt_file)
    
    print(f"Loading model from: {args.model_path}")
    print(f"Prompt: {prompt}")
    print("-" * 50)
    
    # Initialize vLLM
    llm = LLM(
        model=args.model_path,
        dtype=args.dtype
    )
    
    # Set up sampling parameters
    sampling_params = SamplingParams(
        temperature=args.temperature,
        top_p=args.top_p,
        top_k=args.top_k,
        max_tokens=args.max_tokens
    )
    
    # Generate text
    outputs = llm.generate([prompt], sampling_params)
    
    # Print results
    for output in outputs:
        print("Generated text:")
        print(output.outputs[0].text)


if __name__ == "__main__":
    main()
[tab] slurm/dev/franz/berlin/crowd-pilot/qwen_0_6/convert_checkpoint_to_hf.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=02:00:00
#SBATCH --cpus-per-task=4
#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=convert_maxtext_to_hf
#SBATCH --requeue

# Usage:
#   sbatch convert_checkpoint_to_hf.sh \
#     /path/to/maxtext/checkpoints/0/items \
#     qwen3-0.6b \
#     /path/to/output/hf_dir \
#     <optional_hf_token>

set -euo pipefail

cat $0

if [ $# -lt 3 ]; then
  echo "Usage: $0 <CHECKPOINT_PATH> <MODEL_NAME> <HF_OUT_DIR> [HF_ACCESS_TOKEN]" >&2
  exit 1
fi

CHECKPOINT_PATH="$1"
MODEL_NAME="$2"
HF_OUT_DIR="$3"
HF_ACCESS_TOKEN="${4-}"

cd /home/franz.srambical/crowd-pilot/maxtext
source .venv/bin/activate

mkdir -p "$HF_OUT_DIR"

python3 -m MaxText.utils.ckpt_conversion.to_huggingface src/MaxText/configs/base.yml \
  model_name=$MODEL_NAME \
  load_parameters_path=$CHECKPOINT_PATH \
  base_output_directory=$HF_OUT_DIR \
  scan_layers=false \
  use_multimodal=false \
  hf_access_token=$HF_ACCESS_TOKEN

echo "Converted HF model saved to: $HF_OUT_DIR"
[tab] /home/franz.srambical/jafar/slurm/jobs/franz/berlin/atari/data_upload/upload_to_hf.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/atari/data_upload/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/data_upload/%x_%j.log
#SBATCH --job-name=upload_to_hf

source .venv/bin/activate

python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/alien p-doom/atari-alien --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/amidar p-doom/atari-amidar --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/assault p-doom/atari-assault --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/asterix p-doom/atari-asterix --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/bank_heist p-doom/atari-bank_heist --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/battle_zone p-doom/atari-battle_zone --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/boxing p-doom/atari-boxing --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/breakout p-doom/atari-breakout --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/chopper_command p-doom/atari-chopper_command --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/crazy_climber p-doom/atari-crazy_climber --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/demon_attack p-doom/atari-demon_attack --repo-type dataset
python slurm/utils/mihir/upload_hf_dataset.py /fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/pong p-doom/atari-pong --repo-type dataset
[content] slurm/dev/franz/berlin/crowd-pilot/decode_sglang.py (python)
from sglang.test.doc_patch import launch_server_cmd
from sglang.utils import wait_for_server, print_highlight, terminate_process

# This is equivalent to running the following command in your terminal
# python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct --host 0.0.0.0

server_process, port = launch_server_cmd(
    """
python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct \
 --host 0.0.0.0 --log-level warning
"""
)

wait_for_server(f"http://localhost:{port}")
[tab] slurm/dev/franz/berlin/crowd-pilot/launch_sglang_server.py (python)
from sglang.test.doc_patch import launch_server_cmd
from sglang.utils import wait_for_server, print_highlight, terminate_process

# This is equivalent to running the following command in your terminal
# python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct --host 0.0.0.0

server_process, port = launch_server_cmd(
    """
python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct \
 --host 0.0.0.0 --log-level warning
"""
)

wait_for_server(f"http://localhost:{port}")