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
| """ | |
| Reusable building-block layers: RMSNorm, RotaryEmbedding, SwiGLU. | |
| """ | |
| from __future__ import annotations | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| # --------------------------------------------------------------------------- | |
| # Optional TransformerEngine import (FP8 support) | |
| # --------------------------------------------------------------------------- | |
| try: | |
| import transformer_engine.pytorch as te # type: ignore[import] | |
| HAS_TE = True | |
| except ImportError: | |
| te = None # type: ignore[assignment] | |
| HAS_TE = False | |
| # --------------------------------------------------------------------------- | |
| # RMS Layer Normalisation | |
| # --------------------------------------------------------------------------- | |
| class RMSNorm(nn.Module): | |
| """Root-Mean-Square Layer Normalisation (Zhang & Sennrich, 2019). | |
| Computation is promoted to float32 for numerical stability and cast back | |
| to the input dtype before returning. | |
| """ | |
| def __init__(self, d_model: int, eps: float = 1e-6) -> None: | |
| super().__init__() | |
| self.eps = eps | |
| self.weight = nn.Parameter(torch.ones(d_model)) | |
| def _norm(self, x: torch.Tensor) -> torch.Tensor: | |
| # x: (..., D) — compute in fp32 | |
| return x * torch.rsqrt(x.pow(2).mean(dim=-1, keepdim=True) + self.eps) | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| # Upcast to float32, normalise, scale, then restore original dtype. | |
| out = self._norm(x.float()).to(x.dtype) | |
| return out * self.weight | |
| # --------------------------------------------------------------------------- | |
| # Rotary Positional Embedding | |
| # --------------------------------------------------------------------------- | |
| class RotaryEmbedding(nn.Module): | |
| """Precomputed rotary positional embeddings (Su et al., RoFormer 2021). | |
| Cos/sin tables are stored as buffers (shape: max_seq_len × D//2) so they | |
| move with the module to the correct device automatically. | |
| """ | |
| def __init__(self, dim: int, max_seq_len: int, theta: float = 10000.0) -> None: | |
| super().__init__() | |
| self.dim = dim | |
| self.max_seq_len = max_seq_len | |
| self.theta = theta | |
| # Precompute and register | |
| cos, sin = self._build_tables(dim, max_seq_len, theta) | |
| self.register_buffer("_cos_cached", cos, persistent=False) | |
| self.register_buffer("_sin_cached", sin, persistent=False) | |
| def _build_tables( | |
| dim: int, max_seq_len: int, theta: float | |
| ) -> tuple[torch.Tensor, torch.Tensor]: | |
| """Compute cos/sin tables with shape (max_seq_len, dim // 2).""" | |
| half_dim = dim // 2 | |
| # Inverse frequencies: shape (half_dim,) | |
| freqs = 1.0 / ( | |
| theta ** (torch.arange(0, half_dim, dtype=torch.float32) / half_dim) | |
| ) | |
| # Positions: shape (max_seq_len,) | |
| t = torch.arange(max_seq_len, dtype=torch.float32) | |
| # Outer product → (max_seq_len, half_dim) | |
| emb = torch.outer(t, freqs) | |
| cos = emb.cos() # (T, D//2) | |
| sin = emb.sin() # (T, D//2) | |
| return cos, sin | |
| def forward(self, seq_len: int, device: torch.device) -> tuple[torch.Tensor, torch.Tensor]: | |
| """Return (cos, sin) slices of shape (seq_len, D//2) on *device*. | |
| If *seq_len* exceeds the precomputed length the tables are recomputed | |
| on-the-fly (rare, but graceful fallback). | |
| """ | |
| if seq_len > self.max_seq_len: | |
| cos, sin = self._build_tables(self.dim, seq_len, self.theta) | |
| cos = cos.to(device) | |
| sin = sin.to(device) | |
| else: | |
| cos = self._cos_cached[:seq_len].to(device) | |
| sin = self._sin_cached[:seq_len].to(device) | |
| return cos, sin | |
| # --------------------------------------------------------------------------- | |
| # SwiGLU Feed-Forward Network | |
| # --------------------------------------------------------------------------- | |
| class SwiGLU(nn.Module): | |
| """SwiGLU feed-forward block (Shazeer, 2020). | |
| Architecture: | |
| out = down_proj( SiLU(gate_proj(x)) * up_proj(x) ) | |
| The gate and up projections are separate linear layers so that the gating | |
| mechanism can learn an independent representation. | |
| """ | |
| def __init__(self, d_model: int, d_ffn: int, bias: bool = False) -> None: | |
| super().__init__() | |
| self.gate_proj = nn.Linear(d_model, d_ffn, bias=bias) | |
| self.up_proj = nn.Linear(d_model, d_ffn, bias=bias) | |
| self.down_proj = nn.Linear(d_ffn, d_model, bias=bias) | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| # Gated activation: element-wise product of SiLU(gate) and up projection | |
| return self.down_proj(F.silu(self.gate_proj(x)) * self.up_proj(x)) | |