Text Generation
Transformers
Safetensors
metallm
custom-code
ml-engineering
specialist
metallum
custom_code
Instructions to use HomeBrewedLabs/metallum-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HomeBrewedLabs/metallum-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HomeBrewedLabs/metallum-1b", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("HomeBrewedLabs/metallum-1b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HomeBrewedLabs/metallum-1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HomeBrewedLabs/metallum-1b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HomeBrewedLabs/metallum-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HomeBrewedLabs/metallum-1b
- SGLang
How to use HomeBrewedLabs/metallum-1b 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 "HomeBrewedLabs/metallum-1b" \ --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": "HomeBrewedLabs/metallum-1b", "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 "HomeBrewedLabs/metallum-1b" \ --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": "HomeBrewedLabs/metallum-1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HomeBrewedLabs/metallum-1b with Docker Model Runner:
docker model run hf.co/HomeBrewedLabs/metallum-1b
File size: 2,232 Bytes
f73da3f | 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 | """HF config for MetaLLM / Vishvakarma (custom arch: NoPE-every-N, QK-norm, GQA, SwiGLU).
Field names intentionally mirror configs/model.py:ModelConfig so this object can be
passed directly to metallm_core.MetaLLMv2 as its `cfg` (duck-typed).
"""
from transformers import PretrainedConfig
class MetaLLMConfig(PretrainedConfig):
model_type = "metallm"
def __init__(
self,
vocab_size: int = 40000,
n_layers: int = 26,
d_model: int = 1792,
n_heads: int = 28,
n_kv_heads: int = 14,
d_ff: int = 4864,
max_seq_len: int = 2048,
rope_theta: float = 500_000.0,
norm_eps: float = 1e-5,
tie_embeddings: bool = True,
qk_norm: bool = True,
z_loss_weight: float = 0.0, # inference shim: aux loss unused, kept for fidelity
rope_fp32: bool = True,
doc_mask: bool = True, # equals plain causal for single-document prompts
attn_impl: str = "sdpa", # "sdpa" is the portable inference default
nope_every: int = 4,
bos_id: int = 1,
**kwargs,
):
self.vocab_size = vocab_size
self.n_layers = n_layers
self.d_model = d_model
self.n_heads = n_heads
self.n_kv_heads = n_kv_heads
self.d_ff = d_ff
self.max_seq_len = max_seq_len
self.rope_theta = rope_theta
self.norm_eps = norm_eps
self.tie_embeddings = tie_embeddings
self.qk_norm = qk_norm
self.z_loss_weight = z_loss_weight
self.rope_fp32 = rope_fp32
self.doc_mask = doc_mask
self.attn_impl = attn_impl
self.nope_every = nope_every
self.bos_id = bos_id
# standard-name aliases: transformers>=5.13 core reads these directly
self.num_hidden_layers = n_layers
self.hidden_size = d_model
self.num_attention_heads = n_heads
self.num_key_value_heads = n_kv_heads
self.max_position_embeddings = max_seq_len
kwargs.setdefault("tie_word_embeddings", tie_embeddings)
kwargs.setdefault("bos_token_id", bos_id)
super().__init__(**kwargs)
@property
def head_dim(self) -> int:
return self.d_model // self.n_heads
|