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 Studio
How to use pathcosmos/frankenstallm with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pathcosmos/frankenstallm to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for pathcosmos/frankenstallm to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for pathcosmos/frankenstallm to start chatting
- 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: 7,920 Bytes
5b1ff4d | 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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | """
task_runner.py — Thin CLI entry point for subprocess GPU workers.
Usage:
CUDA_VISIBLE_DEVICES=5 python eval/tasks/task_runner.py \
--task calibration --gpu-id 5 --output /path/to/result.json
"""
import argparse
import json
import os
import sys
import traceback
from pathlib import Path
# ---------------------------------------------------------------------------
# Project root on sys.path
# ---------------------------------------------------------------------------
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
# ---------------------------------------------------------------------------
# NUMA affinity helper
# ---------------------------------------------------------------------------
def _set_numa_affinity(gpu_id: int) -> None:
"""Pin the process to the NUMA node that owns the given GPU.
GPU 0-3 → cores 0-35 (NUMA node 0)
GPU 4-7 → cores 36-71 (NUMA node 1)
"""
try:
import os
if gpu_id <= 3:
cores = list(range(0, 36))
else:
cores = list(range(36, 72))
# os.sched_setaffinity is available on Linux
os.sched_setaffinity(0, cores)
print(
f"[TASK_RUNNER gpu_id={gpu_id}] NUMA affinity set: cores {cores[0]}-{cores[-1]}",
flush=True,
)
except Exception as exc:
# Non-fatal — just warn and continue
print(
f"[TASK_RUNNER gpu_id={gpu_id}] WARNING: could not set NUMA affinity: {exc}",
flush=True,
)
# ---------------------------------------------------------------------------
# Task dispatch
# ---------------------------------------------------------------------------
VALID_TASKS = {
"ppl_single",
"ppl_multi",
"calibration",
"token_nll",
"calib_nll",
"generation",
"repetition_grid",
"lm_eval",
}
def _run_task(args: argparse.Namespace) -> dict:
task = args.task
device = "cuda:0" # CUDA_VISIBLE_DEVICES already set by parent
if task == "ppl_single":
if not args.val_file:
raise ValueError("--val-file is required for ppl_single task")
from eval.tasks.ppl_task import eval_ppl_single
result = eval_ppl_single(args.val_file, device)
elif task == "ppl_multi":
if not args.val_files:
raise ValueError("--val-files is required for ppl_multi task")
val_files_list = [f.strip() for f in args.val_files.split(",") if f.strip()]
from eval.tasks.ppl_task import eval_ppl_multi
result = eval_ppl_multi(val_files_list, device)
elif task == "calibration":
from eval.tasks.calibration_task import eval_calibration
result = eval_calibration(device)
elif task == "token_nll":
from eval.tasks.token_nll_task import eval_token_nll
result = eval_token_nll(device)
elif task == "calib_nll":
from eval.tasks.calibration_task import eval_calibration
from eval.tasks.token_nll_task import eval_token_nll
calib_result = eval_calibration(device)
nll_result = eval_token_nll(device)
result = {"calibration": calib_result, "token_nll": nll_result}
elif task == "generation":
from eval.tasks.generation_task import eval_generation
result = eval_generation(device)
elif task == "repetition_grid":
from eval.tasks.generation_task import eval_repetition_grid
result = eval_repetition_grid(device)
elif task == "lm_eval":
if not args.hf_model_path:
raise ValueError("--hf-model-path is required for lm_eval task")
if not args.lm_eval_tasks:
raise ValueError("--lm-eval-tasks is required for lm_eval task")
tasks_list = [t.strip() for t in args.lm_eval_tasks.split(",") if t.strip()]
if args.fewshot_list:
# Pipeline mode: load model once, run multiple fewshot settings
fewshot_values = [int(x.strip()) for x in args.fewshot_list.split(",")]
from eval.tasks.lm_eval_task import run_lm_eval_tasks_pipeline
result = run_lm_eval_tasks_pipeline(
args.hf_model_path,
tasks_list,
device,
fewshot_values,
output_dir=str(Path(args.output).parent),
output_prefix=Path(args.output).stem,
)
else:
from eval.tasks.lm_eval_task import run_lm_eval_tasks
result = run_lm_eval_tasks(
args.hf_model_path,
tasks_list,
device,
num_fewshot=args.num_fewshot,
)
else:
raise ValueError(f"Unknown task: {task!r}. Valid tasks: {sorted(VALID_TASKS)}")
return result
# ---------------------------------------------------------------------------
# CLI
# ---------------------------------------------------------------------------
def _parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Thin CLI entry point for subprocess GPU eval workers."
)
parser.add_argument(
"--task",
required=True,
choices=sorted(VALID_TASKS),
help="Eval task to run.",
)
parser.add_argument(
"--gpu-id",
type=int,
required=True,
help="Original GPU ID (used for NUMA affinity only).",
)
parser.add_argument(
"--output",
required=True,
help="Path to write JSON result file.",
)
# --- ppl_single ---
parser.add_argument(
"--val-file",
default=None,
help="Single validation filename (for ppl_single).",
)
# --- ppl_multi ---
parser.add_argument(
"--val-files",
default=None,
help="Comma-separated validation filenames (for ppl_multi).",
)
# --- lm_eval ---
parser.add_argument(
"--hf-model-path",
default=None,
help="HuggingFace model directory (for lm_eval).",
)
parser.add_argument(
"--lm-eval-tasks",
default=None,
help="Comma-separated lm-eval task names (for lm_eval).",
)
parser.add_argument(
"--num-fewshot",
type=int,
default=0,
help="Number of few-shot examples (for lm_eval). Default: 0.",
)
parser.add_argument(
"--fewshot-list",
default=None,
help="Comma-separated fewshot values to run sequentially, e.g. '0,5'. "
"Model is loaded once and reused. Overrides --num-fewshot.",
)
return parser.parse_args()
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
def main() -> None:
args = _parse_args()
gpu_id = args.gpu_id
task_name = args.task
output_path = args.output
print(f"[TASK_RUNNER gpu_id={gpu_id}] Starting task={task_name}", flush=True)
# Set NUMA affinity early
_set_numa_affinity(gpu_id)
exit_code = 0
try:
result = _run_task(args)
payload = result
except Exception as exc:
tb_str = traceback.format_exc()
print(
f"[TASK_RUNNER gpu_id={gpu_id}] ERROR in task={task_name}:\n{tb_str}",
file=sys.stderr,
flush=True,
)
payload = {"error": str(exc), "traceback": tb_str}
exit_code = 1
# Write result JSON
output_path_obj = Path(output_path)
output_path_obj.parent.mkdir(parents=True, exist_ok=True)
with open(output_path_obj, "w", encoding="utf-8") as fh:
json.dump(payload, fh, ensure_ascii=False, indent=2, default=str)
print(
f"[TASK_RUNNER gpu_id={gpu_id}] Done. Result saved to {output_path}",
flush=True,
)
sys.exit(exit_code)
if __name__ == "__main__":
main()
|