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")# pip install -U transformers accelerate # 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
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -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
- Llama new
- 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
Download source/scripts/run_eval_full.sh from pathcosmos/frankenstallm: direct link, hf CLI and curl.
- Browser
- Download file 8.73 kB
-
https://huggingface.co/pathcosmos/frankenstallm/resolve/refs%2Fpr%2F49/source/scripts/run_eval_full.sh
- Command line
-
hf download hf://pathcosmos/frankenstallm@refs/pr/49/source/scripts/run_eval_full.sh
-
curl -L -o run_eval_full.sh https://huggingface.co/pathcosmos/frankenstallm/resolve/refs%2Fpr%2F49/source/scripts/run_eval_full.sh
8.73 kB
| # ============================================================ | |
| # run_eval_full.sh β μ 체 νκ΅μ΄ λ²€μΉλ§ν¬ νκ° (λͺ©ν: 1.5-3μκ°) | |
| # | |
| # μ¬μ©λ²: | |
| # bash scripts/run_eval_full.sh [CHECKPOINT_DIR] [OUTPUT_DIR] | |
| # | |
| # μμ: | |
| # bash scripts/run_eval_full.sh \ | |
| # checkpoints/korean_1b_sft/checkpoint-0005000 \ | |
| # eval/outputs/full_5000 | |
| # | |
| # νμ€ν¬: | |
| # - KoBEST (5): boolq, copa, hellaswag, sentineg, wic | |
| # - HAE-RAE Bench (5): general_knowledge, history, loan_word, rare_word, standard_nomenclature | |
| # - Global MMLU Korean: 57κ° λλ©μΈ | |
| # - PAWS-Ko: ν¨λ¬νλ μ΄μ¦ νμ§ | |
| # - KorMedMCQA: νκ΅μ΄ μν MCQ (μ ν) | |
| # | |
| # μ΄ μμ μν: ~15,000κ° | |
| # 1B λͺ¨λΈ @ 8ΓB200 κΈ°μ€: μ½ 1.5-3μκ° | |
| # ============================================================ | |
| set -euo pipefail | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| PROJECT_DIR="$(dirname "$SCRIPT_DIR")" | |
| # βββ μΈμ μ²λ¦¬ ββββββββββββββββββββββββββββββββββββββββββββ | |
| CHECKPOINT="${1:-checkpoints/korean_1b_sft/checkpoint-0005000}" | |
| TIMESTAMP="$(date +%Y%m%d_%H%M%S)" | |
| OUTPUT_DIR="${2:-eval/outputs/full_${TIMESTAMP}}" | |
| [[ "$CHECKPOINT" != /* ]] && CHECKPOINT="$PROJECT_DIR/$CHECKPOINT" | |
| [[ "$OUTPUT_DIR" != /* ]] && OUTPUT_DIR="$PROJECT_DIR/$OUTPUT_DIR" | |
| # βββ μ€μ ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| HF_MODEL_DIR="$PROJECT_DIR/outputs/hf_$(basename "$CHECKPOINT")" | |
| TOKENIZER="$PROJECT_DIR/tokenizer/korean_sp/tokenizer.json" | |
| # GPU μ€μ : λ¨μΌ GPU λλ tensor parallel | |
| # lm-evalμ hf backendλ κΈ°λ³Έ λ¨μΌ GPU μ¬μ© | |
| # λ©ν° GPU: --model_args "pretrained=...,parallelize=True" (μλ device_map) | |
| USE_MULTI_GPU="${USE_MULTI_GPU:-0}" | |
| if [ "$USE_MULTI_GPU" = "1" ]; then | |
| MODEL_EXTRA_ARGS=",parallelize=True" | |
| echo "βΆ λ©ν° GPU λͺ¨λ νμ±ν (device_map=auto)" | |
| else | |
| MODEL_EXTRA_ARGS="" | |
| CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0}" | |
| fi | |
| BATCH_SIZE="${BATCH_SIZE:-auto}" | |
| NUM_FEWSHOT="${NUM_FEWSHOT:-0}" | |
| # βββ νμ€ν¬ μ μ βββββββββββββββββββββββββββββββββββββββββ | |
| # Core Korean tasks (νμ μ€ν) | |
| TASKS_CORE="kobest,haerae,paws_ko" | |
| # Extended tasks (μκ° μμ λ) | |
| TASKS_EXTENDED="global_mmlu_ko" | |
| # μ νμ νμ€ν¬ | |
| TASKS_OPTIONAL="kormedmcqa" # νκ΅μ΄ μν MCQ | |
| # μ 체 μ€ν νμ€ν¬ | |
| TASKS="${TASKS_CORE},${TASKS_EXTENDED}" | |
| # βββ μμ‘΄μ± νμΈ βββββββββββββββββββββββββββββββββββββββββ | |
| check_dep() { | |
| python3 -c "import $1" 2>/dev/null || { echo "β $1 not found. pip install $2"; exit 1; } | |
| } | |
| check_dep lm_eval lm-eval | |
| check_dep transformers transformers | |
| check_dep safetensors safetensors | |
| echo "==================================================" | |
| echo " Ko-LLM Full Benchmark Evaluation" | |
| echo "==================================================" | |
| echo " Checkpoint : $CHECKPOINT" | |
| echo " HF output : $HF_MODEL_DIR" | |
| echo " Tasks : $TASKS" | |
| echo " Few-shot : $NUM_FEWSHOT" | |
| echo " Batch size : $BATCH_SIZE" | |
| echo " Output : $OUTPUT_DIR" | |
| echo " Multi-GPU : $USE_MULTI_GPU" | |
| echo " Start time : $(date)" | |
| echo "==================================================" | |
| mkdir -p "$OUTPUT_DIR" | |
| LOG_FILE="$OUTPUT_DIR/eval_full.log" | |
| # βββ Step 1: HF ν¬λ§· λ³ν βββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "βΆ [1/3] 컀μ€ν 체ν¬ν¬μΈνΈ β HF ν¬λ§· λ³ν..." | |
| if [ ! -f "$HF_MODEL_DIR/config.json" ]; then | |
| python3 "$PROJECT_DIR/scripts/convert_to_hf.py" \ | |
| --checkpoint "$CHECKPOINT" \ | |
| --output "$HF_MODEL_DIR" \ | |
| --tokenizer "$TOKENIZER" \ | |
| 2>&1 | tee -a "$LOG_FILE" | |
| echo "β HF λ³ν μλ£: $HF_MODEL_DIR" | |
| else | |
| echo " β³ HF λͺ¨λΈ μ΄λ―Έ μ‘΄μ¬, λ³ν μ€ν΅: $HF_MODEL_DIR" | |
| fi | |
| # βββ Step 2: μ 체 νκ° ββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "βΆ [2/3] lm-eval μ 체 νκ° μμ..." | |
| echo " β³ λ‘κ·Έ: $LOG_FILE" | |
| START_TIME=$(date +%s) | |
| if [ "$USE_MULTI_GPU" = "1" ]; then | |
| python3 -m lm_eval \ | |
| --model hf \ | |
| --model_args "pretrained=$HF_MODEL_DIR,dtype=float16,parallelize=True" \ | |
| --tasks "$TASKS" \ | |
| --num_fewshot "$NUM_FEWSHOT" \ | |
| --batch_size "$BATCH_SIZE" \ | |
| --output_path "$OUTPUT_DIR" \ | |
| --log_samples \ | |
| --verbosity INFO \ | |
| 2>&1 | tee -a "$LOG_FILE" | |
| else | |
| CUDA_VISIBLE_DEVICES="$CUDA_VISIBLE_DEVICES" python3 -m lm_eval \ | |
| --model hf \ | |
| --model_args "pretrained=$HF_MODEL_DIR,dtype=float16" \ | |
| --tasks "$TASKS" \ | |
| --num_fewshot "$NUM_FEWSHOT" \ | |
| --batch_size "$BATCH_SIZE" \ | |
| --output_path "$OUTPUT_DIR" \ | |
| --log_samples \ | |
| --verbosity INFO \ | |
| 2>&1 | tee -a "$LOG_FILE" | |
| fi | |
| END_TIME=$(date +%s) | |
| ELAPSED=$(( END_TIME - START_TIME )) | |
| echo "" | |
| echo "β νκ° μλ£! μμ: $((ELAPSED/60))λΆ $((ELAPSED%60))μ΄" | |
| # βββ Step 3: κ²°κ³Ό μμ½ λ¦¬ν¬νΈ μμ± βββββββββββββββββββββ | |
| echo "" | |
| echo "βΆ [3/3] κ²°κ³Ό 리ν¬νΈ μμ±..." | |
| python3 - "$OUTPUT_DIR" "$CHECKPOINT" <<'PYEOF' | |
| import json, glob, sys, os | |
| from datetime import datetime | |
| output_dir = sys.argv[1] | |
| checkpoint = sys.argv[2] if len(sys.argv) > 2 else "unknown" | |
| results_files = sorted(glob.glob(f"{output_dir}/**/*.json", recursive=True)) | |
| results_files = [f for f in results_files if "samples_" not in os.path.basename(f)] | |
| report_lines = [ | |
| f"# Ko-LLM Full Eval Report", | |
| f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}", | |
| f"Checkpoint: {checkpoint}", | |
| "", | |
| ] | |
| all_results = {} | |
| for rf in results_files: | |
| try: | |
| with open(rf) as f: | |
| data = json.load(f) | |
| results = data.get("results", {}) | |
| if results: | |
| all_results.update(results) | |
| except Exception: | |
| pass | |
| # KoBEST μμ½ | |
| kobest_tasks = [k for k in all_results if k.startswith("kobest_")] | |
| if kobest_tasks: | |
| report_lines.append("## KoBEST") | |
| report_lines.append("| Task | Metric | Score |") | |
| report_lines.append("|------|--------|-------|") | |
| for task in sorted(kobest_tasks): | |
| metrics = all_results[task] | |
| for key, val in metrics.items(): | |
| if "stderr" not in key and isinstance(val, (int, float)): | |
| report_lines.append(f"| {task} | {key} | {val:.4f} |") | |
| # HAE-RAE μμ½ | |
| haerae_tasks = [k for k in all_results if k.startswith("haerae")] | |
| if haerae_tasks: | |
| report_lines.append("\n## HAE-RAE Bench") | |
| report_lines.append("| Task | Metric | Score |") | |
| report_lines.append("|------|--------|-------|") | |
| for task in sorted(haerae_tasks): | |
| metrics = all_results[task] | |
| for key, val in metrics.items(): | |
| if "stderr" not in key and isinstance(val, (int, float)): | |
| report_lines.append(f"| {task} | {key} | {val:.4f} |") | |
| # MMLU Ko μμ½ (μμ λ 벨λ§) | |
| mmlu_top = {k: v for k, v in all_results.items() | |
| if k.startswith("global_mmlu_ko") and "_" not in k.replace("global_mmlu_ko", "")} | |
| if mmlu_top: | |
| report_lines.append("\n## Global MMLU (Korean)") | |
| for task, metrics in mmlu_top.items(): | |
| for key, val in metrics.items(): | |
| if "stderr" not in key and isinstance(val, (int, float)): | |
| report_lines.append(f"- {task} {key}: {val:.4f}") | |
| # κΈ°ν | |
| other_tasks = [k for k in all_results | |
| if not k.startswith("kobest_") | |
| and not k.startswith("haerae") | |
| and not k.startswith("global_mmlu_ko")] | |
| if other_tasks: | |
| report_lines.append("\n## κΈ°ν νμ€ν¬") | |
| for task in sorted(other_tasks): | |
| metrics = all_results[task] | |
| for key, val in metrics.items(): | |
| if "stderr" not in key and isinstance(val, (int, float)): | |
| report_lines.append(f"- {task} | {key}: {val:.4f}") | |
| report_path = os.path.join(output_dir, "SUMMARY.md") | |
| with open(report_path, "w") as f: | |
| f.write("\n".join(report_lines)) | |
| print("\n".join(report_lines)) | |
| print(f"\nπ 리ν¬νΈ μ μ₯: {report_path}") | |
| PYEOF | |
| echo "" | |
| echo "==================================================" | |
| echo "β μ 체 νκ° μλ£!" | |
| echo " κ²°κ³Ό λλ ν 리: $OUTPUT_DIR" | |
| echo " μμ½ λ¦¬ν¬νΈ : $OUTPUT_DIR/SUMMARY.md" | |
| echo " μ 체 λ‘κ·Έ : $LOG_FILE" | |
| echo " μλ£ μκ° : $(date)" | |
| echo "==================================================" | |