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
| # ============================================================================= | |
| # monitor_training.sh โ SFT ํ์ต ์ค์๊ฐ ๋ชจ๋ํฐ๋ง + ์ด์ ๊ฐ์ง | |
| # | |
| # Usage: | |
| # bash scripts/monitor_training.sh # ๊ธฐ๋ณธ ๋ก๊ทธ ๊ฒฝ๋ก | |
| # bash scripts/monitor_training.sh /path/to/train.log # ์ปค์คํ ๊ฒฝ๋ก | |
| # bash scripts/monitor_training.sh --check-once # 1ํ ๊ฒ์ฌ ํ ์ข ๋ฃ | |
| # | |
| # ๊ฐ์ ํญ๋ชฉ: | |
| # ๐ด loss = 0.0000 (3 step ์ฐ์) โ Labels ๋ฒ๊ทธ | |
| # ๐ด gnorm > 50.0 โ ๋ฐ์ฐ ์ง์ | |
| # ๐ด ๋ก๊ทธ 5๋ถ ์ด์ ๋ฉ์ถค โ Hang | |
| # ๐ loss spike (3ร ์ด๋ํ๊ท ) โ Bad batch / LR | |
| # ๐ gnorm > 10.0 โ ๋ถ์์ | |
| # ๐ ๋์คํฌ > 80% โ ์ ๋ฆฌ ํ์ | |
| # ๐ก GPU util < 50% โ ๋ณ๋ชฉ | |
| # ============================================================================= | |
| set -euo pipefail | |
| # ---- Configuration ---------------------------------------------------------- | |
| LOG_FILE="${1:-checkpoints/korean_1b_sft/train.log}" | |
| CHECK_INTERVAL=30 # ์ด ๋จ์ ํด๋ง ๊ฐ๊ฒฉ | |
| ZERO_LOSS_THRESHOLD=3 # Nํ ์ฐ์ loss=0์ด๋ฉด ๊ฒฝ๊ณ | |
| GNORM_WARN=10.0 | |
| GNORM_CRITICAL=50.0 | |
| LOSS_SPIKE_FACTOR=3.0 # ์ด๋ํ๊ท ๋๋น N๋ฐฐ ์ด์์ด๋ฉด spike | |
| STALL_TIMEOUT=300 # ์ด (5๋ถ) ๋ก๊ทธ ๋ฉ์ถค ๊ฐ์ง | |
| DISK_WARN_PCT=80 | |
| GPU_UTIL_WARN=50 | |
| CHECK_ONCE=false | |
| if [[ "${1:-}" == "--check-once" ]]; then | |
| CHECK_ONCE=true | |
| LOG_FILE="${2:-checkpoints/korean_1b_sft/train.log}" | |
| fi | |
| # ---- Colors ----------------------------------------------------------------- | |
| RED='\033[0;31m' | |
| YELLOW='\033[1;33m' | |
| GREEN='\033[0;32m' | |
| CYAN='\033[0;36m' | |
| NC='\033[0m' | |
| # ---- Helper ----------------------------------------------------------------- | |
| timestamp() { date '+%Y-%m-%d %H:%M:%S'; } | |
| alert() { | |
| local level="$1" msg="$2" | |
| case "$level" in | |
| CRITICAL) echo -e "${RED}๐ด [$(timestamp)] [CRITICAL] ${msg}${NC}" ;; | |
| WARNING) echo -e "${YELLOW}๐ [$(timestamp)] [WARNING] ${msg}${NC}" ;; | |
| INFO) echo -e "${CYAN}๐ก [$(timestamp)] [INFO] ${msg}${NC}" ;; | |
| OK) echo -e "${GREEN}โ [$(timestamp)] [OK] ${msg}${NC}" ;; | |
| esac | |
| } | |
| # ---- Parse last N log lines ------------------------------------------------- | |
| parse_metrics() { | |
| # ๋ก๊ทธ ํ์: [timestamp] [INFO] step XXXX | loss X.XXXX | lr X.XXe-XX | gnorm X.XXX | ... | |
| local n="${1:-20}" | |
| if [[ ! -f "$LOG_FILE" ]]; then | |
| echo "" | |
| return | |
| fi | |
| tail -n "$n" "$LOG_FILE" | grep "step.*loss.*gnorm" || true | |
| } | |
| extract_field() { | |
| # $1=line, $2=field name (loss, gnorm, lr) | |
| echo "$1" | grep -oP "${2}\s+\K[0-9]+\.[0-9e+\-]+" | head -1 | |
| } | |
| # ---- Check functions -------------------------------------------------------- | |
| check_loss_zero() { | |
| local lines | |
| lines=$(parse_metrics "$ZERO_LOSS_THRESHOLD") | |
| if [[ -z "$lines" ]]; then return; fi | |
| local zero_count=0 | |
| while IFS= read -r line; do | |
| local loss | |
| loss=$(extract_field "$line" "loss") | |
| if [[ -n "$loss" ]]; then | |
| # loss < 0.001 | |
| if (( $(echo "$loss < 0.001" | bc -l 2>/dev/null || echo 0) )); then | |
| ((zero_count++)) | |
| fi | |
| fi | |
| done <<< "$lines" | |
| if [[ $zero_count -ge $ZERO_LOSS_THRESHOLD ]]; then | |
| alert CRITICAL "Loss๊ฐ ${zero_count}ํ ์ฐ์ ~0! Labels ๋ฒ๊ทธ ๊ฐ๋ฅ์ฑ. ์ฆ์ ํ์ต ์ค๋จ!" | |
| return 1 | |
| fi | |
| return 0 | |
| } | |
| check_loss_spike() { | |
| local lines | |
| lines=$(parse_metrics 20) | |
| if [[ -z "$lines" ]]; then return 0; fi | |
| local losses=() | |
| while IFS= read -r line; do | |
| local loss | |
| loss=$(extract_field "$line" "loss") | |
| [[ -n "$loss" ]] && losses+=("$loss") | |
| done <<< "$lines" | |
| local count=${#losses[@]} | |
| if [[ $count -lt 5 ]]; then return 0; fi | |
| # ๋ง์ง๋ง ๊ฐ๊ณผ ์ด์ ํ๊ท ๋น๊ต | |
| local last_loss="${losses[$((count-1))]}" | |
| local sum=0 | |
| for ((i=0; i<count-1; i++)); do | |
| sum=$(echo "$sum + ${losses[$i]}" | bc -l 2>/dev/null || echo "$sum") | |
| done | |
| local avg=$(echo "$sum / ($count - 1)" | bc -l 2>/dev/null || echo "0") | |
| if [[ "$avg" != "0" ]]; then | |
| local ratio=$(echo "$last_loss / $avg" | bc -l 2>/dev/null || echo "1") | |
| if (( $(echo "$ratio > $LOSS_SPIKE_FACTOR" | bc -l 2>/dev/null || echo 0) )); then | |
| alert WARNING "Loss spike ๊ฐ์ง! ํ์ฌ=${last_loss}, ํ๊ท =${avg}, ๋น์จ=${ratio}x" | |
| fi | |
| fi | |
| return 0 | |
| } | |
| check_gnorm() { | |
| local lines | |
| lines=$(parse_metrics 5) | |
| if [[ -z "$lines" ]]; then return 0; fi | |
| local last_line | |
| last_line=$(echo "$lines" | tail -1) | |
| local gnorm | |
| gnorm=$(extract_field "$last_line" "gnorm") | |
| if [[ -z "$gnorm" ]]; then return 0; fi | |
| if (( $(echo "$gnorm > $GNORM_CRITICAL" | bc -l 2>/dev/null || echo 0) )); then | |
| alert CRITICAL "GNorm=${gnorm} > ${GNORM_CRITICAL}! ๋ฐ์ฐ ์ง์ . ํ์ต ์ค๋จ ๊ณ ๋ ค." | |
| elif (( $(echo "$gnorm > $GNORM_WARN" | bc -l 2>/dev/null || echo 0) )); then | |
| alert WARNING "GNorm=${gnorm} > ${GNORM_WARN}. ๋ถ์์ ์งํ." | |
| fi | |
| return 0 | |
| } | |
| check_stall() { | |
| if [[ ! -f "$LOG_FILE" ]]; then | |
| alert INFO "๋ก๊ทธ ํ์ผ ์์: ${LOG_FILE}" | |
| return 0 | |
| fi | |
| local last_modified | |
| last_modified=$(stat -c %Y "$LOG_FILE" 2>/dev/null || echo 0) | |
| local now | |
| now=$(date +%s) | |
| local diff=$((now - last_modified)) | |
| if [[ $diff -gt $STALL_TIMEOUT ]]; then | |
| alert CRITICAL "๋ก๊ทธ๊ฐ ${diff}์ด ($(( diff/60 ))๋ถ) ๋์ ์ ๋ฐ์ดํธ ์์! Hang ๊ฐ๋ฅ์ฑ." | |
| fi | |
| return 0 | |
| } | |
| check_disk() { | |
| local usage | |
| usage=$(df /PROJECT 2>/dev/null | awk 'NR==2 {print $5}' | tr -d '%') | |
| if [[ -n "$usage" && "$usage" -gt "$DISK_WARN_PCT" ]]; then | |
| alert WARNING "๋์คํฌ ์ฌ์ฉ๋ฅ ${usage}% > ${DISK_WARN_PCT}%. ์ฒดํฌํฌ์ธํธ ์ ๋ฆฌ ํ์." | |
| fi | |
| return 0 | |
| } | |
| check_gpu() { | |
| if ! command -v nvidia-smi &>/dev/null; then return 0; fi | |
| local low_util=0 | |
| local total_gpus=0 | |
| while IFS= read -r util; do | |
| ((total_gpus++)) | |
| if [[ "$util" -lt "$GPU_UTIL_WARN" ]]; then | |
| ((low_util++)) | |
| fi | |
| done < <(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits 2>/dev/null) | |
| if [[ $total_gpus -gt 0 && $low_util -gt 0 ]]; then | |
| alert INFO "${low_util}/${total_gpus} GPU utilization < ${GPU_UTIL_WARN}%. ๋ฐ์ดํฐ ๋ก๋ฉ ๋ณ๋ชฉ?" | |
| fi | |
| return 0 | |
| } | |
| # ---- Status summary --------------------------------------------------------- | |
| print_status() { | |
| local lines | |
| lines=$(parse_metrics 1) | |
| if [[ -n "$lines" ]]; then | |
| echo -e "${GREEN}์ต๊ทผ ๋ก๊ทธ:${NC} $lines" | |
| fi | |
| if command -v nvidia-smi &>/dev/null; then | |
| echo -e "${CYAN}GPU ๋ฉ๋ชจ๋ฆฌ:${NC}" | |
| nvidia-smi --query-gpu=index,memory.used,memory.total,utilization.gpu \ | |
| --format=csv,noheader 2>/dev/null | head -8 | |
| fi | |
| local disk | |
| disk=$(df -h /PROJECT 2>/dev/null | awk 'NR==2 {print "์ฌ์ฉ: "$3"/"$2" ("$5")"}') | |
| echo -e "${CYAN}๋์คํฌ:${NC} ${disk}" | |
| } | |
| # ---- Main loop -------------------------------------------------------------- | |
| echo "==================================================================" | |
| echo " SFT Training Monitor" | |
| echo " Log file: ${LOG_FILE}" | |
| echo " Check interval: ${CHECK_INTERVAL}s" | |
| echo " Press Ctrl+C to stop" | |
| echo "==================================================================" | |
| run_all_checks() { | |
| check_loss_zero || true | |
| check_loss_spike || true | |
| check_gnorm || true | |
| check_stall || true | |
| check_disk || true | |
| check_gpu || true | |
| echo "---" | |
| print_status | |
| echo "" | |
| } | |
| if $CHECK_ONCE; then | |
| run_all_checks | |
| exit 0 | |
| fi | |
| while true; do | |
| run_all_checks | |
| sleep "$CHECK_INTERVAL" | |
| done | |