Text Generation
Transformers
Safetensors
GGUF
Korean
English
llama
3b
korean
from-scratch
orpo
instruction-tuned
preference-aligned
fp8
b200
Eval Results (legacy)
text-generation-inference
Instructions to use pathcosmos/frankenstallm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pathcosmos/frankenstallm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pathcosmos/frankenstallm")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("pathcosmos/frankenstallm") model = AutoModelForCausalLM.from_pretrained("pathcosmos/frankenstallm", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use pathcosmos/frankenstallm with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf pathcosmos/frankenstallm:Q4_K_M # Run inference directly in the terminal: llama cli -hf pathcosmos/frankenstallm:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf pathcosmos/frankenstallm:Q4_K_M # Run inference directly in the terminal: llama cli -hf pathcosmos/frankenstallm:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf pathcosmos/frankenstallm:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf pathcosmos/frankenstallm:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf pathcosmos/frankenstallm:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf pathcosmos/frankenstallm:Q4_K_M
Use Docker
docker model run hf.co/pathcosmos/frankenstallm:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use pathcosmos/frankenstallm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pathcosmos/frankenstallm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pathcosmos/frankenstallm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/pathcosmos/frankenstallm:Q4_K_M
- SGLang
How to use pathcosmos/frankenstallm with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "pathcosmos/frankenstallm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pathcosmos/frankenstallm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "pathcosmos/frankenstallm" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pathcosmos/frankenstallm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use pathcosmos/frankenstallm with Ollama:
ollama run hf.co/pathcosmos/frankenstallm:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use pathcosmos/frankenstallm with Docker Model Runner:
docker model run hf.co/pathcosmos/frankenstallm:Q4_K_M
- Lemonade
How to use pathcosmos/frankenstallm with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull pathcosmos/frankenstallm:Q4_K_M
Run and chat with the model
lemonade run user.frankenstallm-Q4_K_M
List all available models
lemonade list
- Atomic Chat
File size: 6,265 Bytes
48ecd01 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | #!/usr/bin/env bash
# =============================================================================
# orpo_hp_sweep.sh โ ORPO Hyperparameter Sweep (200 steps each)
#
# ๊ฐ ์ค์ ์ 200 steps์ฉ ๋๋ ค์ ์ต์ ์กฐํฉ์ ์ฐพ๋ ์คํฌ๋ฆฝํธ.
# ๊ฒฐ๊ณผ๋ sweep_results/ ๋๋ ํ ๋ฆฌ์ ์ ์ฅ๋จ.
#
# Usage:
# bash scripts/orpo_hp_sweep.sh # ์ ์ฒด sweep (6 runs)
# bash scripts/orpo_hp_sweep.sh --dry-run # ์ค์ ๋ง ์ถ๋ ฅ
# =============================================================================
set -uo pipefail
# NOTE: set +e โ individual runs may fail; we log failures and continue the sweep
cd "$(dirname "$0")/.."
SWEEP_STEPS=200
SWEEP_DIR="checkpoints/orpo_sweep"
RESULTS_FILE="${SWEEP_DIR}/sweep_results.jsonl"
BASE_MODEL="eval/outputs/hf_3b_sft_best"
DATA_PATH="data/preference/combined_preference.jsonl"
NPROC=8
MASTER_PORT_BASE=29510
# B200 NCCL tuning (NVSwitch mesh โ let NCCL auto-detect proto/channels/algo)
export NCCL_IB_DISABLE=1
export NCCL_BUFFSIZE=134217728
export OMP_NUM_THREADS=9
export MKL_NUM_THREADS=9
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
export NCCL_P2P_LEVEL=NVL
export PYTHONWARNINGS="ignore::UserWarning:torch.library"
mkdir -p "${SWEEP_DIR}"
declare -a FAILED_RUNS=()
# ---------------------------------------------------------------------------
# Sweep configurations: (name, beta, lr, max_length, batch_size, grad_accum)
# ---------------------------------------------------------------------------
# ํต์ฌ ํ์ ์ถ:
# 1. beta: ๋ฐ๋ณต ์ต์ ๊ฐ๋ (0.15 vs 0.25 vs 0.35)
# 2. lr: ์๋ ด ์๋ (5e-6 vs 8e-6 vs 1.2e-5)
# 3. max_length: VRAM vs ์ปค๋ฒ๋ฆฌ์ง (1024 vs 1536)
declare -a CONFIGS=(
# name beta lr max_len bs accum
"baseline_b015_lr8e6 0.15 8e-6 1536 4 4"
"baseline_b025_lr8e6 0.25 8e-6 1536 4 4"
"strong_b035_lr8e6 0.35 8e-6 1536 4 4"
"fast_b025_lr12e6 0.25 1.2e-5 1536 4 4"
"conserv_b025_lr5e6 0.25 5e-6 1536 4 4"
"short_b025_lr8e6 0.25 8e-6 1024 4 4"
)
DRY_RUN=false
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=true
fi
echo "=================================================================="
echo " ORPO Hyperparameter Sweep"
echo " Configs: ${#CONFIGS[@]}"
echo " Steps each: ${SWEEP_STEPS}"
echo " Results: ${RESULTS_FILE}"
echo "=================================================================="
for i in "${!CONFIGS[@]}"; do
read -r NAME BETA LR MAX_LEN BS ACCUM <<< "${CONFIGS[$i]}"
PORT=$((MASTER_PORT_BASE + i))
OUTPUT="${SWEEP_DIR}/${NAME}"
echo ""
echo "--- Run $((i+1))/${#CONFIGS[@]}: ${NAME} ---"
echo " beta=${BETA} lr=${LR} max_length=${MAX_LEN} bs=${BS} accum=${ACCUM}"
if [[ "${DRY_RUN}" == "true" ]]; then
echo " [DRY RUN] skipping"
continue
fi
mkdir -p "${OUTPUT}"
START_TIME=$(date +%s)
torchrun \
--nproc_per_node=${NPROC} \
--master_port=${PORT} \
train/orpo.py \
--model_path "${BASE_MODEL}" \
--custom_data_path "${DATA_PATH}" \
--output_dir "${OUTPUT}" \
--max_steps ${SWEEP_STEPS} \
--lr ${LR} \
--beta ${BETA} \
--batch_size ${BS} \
--gradient_accumulation_steps ${ACCUM} \
--max_length ${MAX_LEN} \
\
--weight_decay 0.01 \
--warmup_ratio 0.05 \
--eval_split_ratio 0.05 \
--eval_steps 100 \
--early_stopping_patience 100 \
--save_steps 200 \
--save_total_limit 1 \
--logging_steps 10 \
--report_to none \
--dataset_num_proc 64 \
--dataloader_num_workers 4 \
--no_load_best \
2>&1 | tee "${OUTPUT}/train.log"
RUN_EXIT=$?
END_TIME=$(date +%s)
ELAPSED=$((END_TIME - START_TIME))
if [[ ${RUN_EXIT} -ne 0 ]]; then
echo " [ERROR] Run ${NAME} failed with exit code ${RUN_EXIT} after ${ELAPSED}s"
echo "{\"name\":\"${NAME}\",\"beta\":${BETA},\"lr\":\"${LR}\",\"max_length\":${MAX_LEN},\"status\":\"FAILED\",\"exit_code\":${RUN_EXIT},\"elapsed_s\":${ELAPSED}}" >> "${RESULTS_FILE}"
FAILED_RUNS+=("${NAME}")
continue
fi
# Extract final metrics from log
FINAL_LOSS=$(grep -oP "'loss': '[\d.]+'" "${OUTPUT}/train.log" | tail -1 | grep -oP "[\d.]+" || echo "N/A")
EVAL_LOSS=$(grep -oP "'eval_loss': '[\d.]+'" "${OUTPUT}/train.log" | tail -1 | grep -oP "[\d.]+" || echo "N/A")
MARGIN=$(grep -oP "'rewards/margins': '[-\d.]+'" "${OUTPUT}/train.log" | tail -1 | grep -oP "[-\d.]+" || echo "N/A")
# Save result
echo "{\"name\":\"${NAME}\",\"beta\":${BETA},\"lr\":\"${LR}\",\"max_length\":${MAX_LEN},\"status\":\"OK\",\"loss\":\"${FINAL_LOSS}\",\"eval_loss\":\"${EVAL_LOSS}\",\"margin\":\"${MARGIN}\",\"elapsed_s\":${ELAPSED}}" >> "${RESULTS_FILE}"
echo " -> loss=${FINAL_LOSS} eval_loss=${EVAL_LOSS} margin=${MARGIN} time=${ELAPSED}s"
# Cleanup weights to save disk (keep logs)
rm -rf "${OUTPUT}/checkpoint-"* "${OUTPUT}/emergency_checkpoint" 2>/dev/null || true
done
echo ""
echo "=================================================================="
echo " Sweep Complete!"
echo " Results: ${RESULTS_FILE}"
if [[ -f "${RESULTS_FILE}" ]]; then
echo ""
echo " Summary:"
cat "${RESULTS_FILE}" | python3 -c "
import sys, json
results = [json.loads(l) for l in sys.stdin]
results.sort(key=lambda r: float(r.get('eval_loss', '999')))
print(f' {\"Name\":<25} {\"Beta\":>6} {\"LR\":>10} {\"Loss\":>8} {\"EvalLoss\":>10} {\"Margin\":>8} {\"Time\":>6}')
print(f' {\"-\"*25} {\"-\"*6} {\"-\"*10} {\"-\"*8} {\"-\"*10} {\"-\"*8} {\"-\"*6}')
for r in results:
print(f' {r[\"name\"]:<25} {r[\"beta\"]:>6} {r[\"lr\"]:>10} {r[\"loss\"]:>8} {r[\"eval_loss\"]:>10} {r[\"margin\"]:>8} {r[\"elapsed_s\"]:>5}s')
print()
best = results[0]
print(f' BEST: {best[\"name\"]} (eval_loss={best[\"eval_loss\"]})')
" 2>/dev/null || cat "${RESULTS_FILE}"
fi
# Report failed runs
if [[ ${#FAILED_RUNS[@]} -gt 0 ]]; then
echo ""
echo " FAILED RUNS (${#FAILED_RUNS[@]}):"
for fname in "${FAILED_RUNS[@]}"; do
echo " - ${fname}"
done
fi
echo "=================================================================="
|