Text Generation
Transformers
Safetensors
English
dynamic_chunked_transformer
dynamic-chunking
byte-level
tokenizer-free
grouped-query-attention
rope
custom_code
Instructions to use Kokasospoperor/dynamic-chunked-48m-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kokasospoperor/dynamic-chunked-48m-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kokasospoperor/dynamic-chunked-48m-v2", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Kokasospoperor/dynamic-chunked-48m-v2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kokasospoperor/dynamic-chunked-48m-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kokasospoperor/dynamic-chunked-48m-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kokasospoperor/dynamic-chunked-48m-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kokasospoperor/dynamic-chunked-48m-v2
- SGLang
How to use Kokasospoperor/dynamic-chunked-48m-v2 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 "Kokasospoperor/dynamic-chunked-48m-v2" \ --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": "Kokasospoperor/dynamic-chunked-48m-v2", "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 "Kokasospoperor/dynamic-chunked-48m-v2" \ --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": "Kokasospoperor/dynamic-chunked-48m-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kokasospoperor/dynamic-chunked-48m-v2 with Docker Model Runner:
docker model run hf.co/Kokasospoperor/dynamic-chunked-48m-v2
DynamicChunkedTransformer-48M (v2)
A 48M-parameter, tokenizer-free UTF-8 byte-level language model trained from scratch on 4B UTF-8 bytes using a two-stage Warmup-Stable-Decay (WSD) schedule.
Architecture Highlights
- Lossless 256-byte Input/Output: Operates directly on raw UTF-8 bytes without BPE or subword vocabularies.
- Causal 1D Conv Boundary Router: Learns adaptive pre-token chunk boundaries (~4.9 bytes/chunk average, capped at 16 bytes) via Gumbel-Softmax straight-through routing.
- Block-Packed Local Encoder: 3-layer causal Transformer (
local_dim=256) operating over packed variable-length byte chunks in $O(T \cdot 16)$ time. - Upper Backbone: 16-layer RoPE Grouped-Query Attention (
emb_dim=512, 8 query heads / 2 KV heads, QK-Norm, SwiGLU) operating over compressed chunk representations. - Validation Performance:
0.9417nats/byte (1.3586bits/byte) on multi-domain holdout.
Quickstart
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "Kokasospoperor/dynamic-chunked-48m-v2"
tokenizer = AutoTokenizer.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True).eval()
prompt = "What makes mucus green?\nShare\nQuestion\n"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
out = model.generate(
inputs.input_ids,
max_new_tokens=120,
do_sample=True,
temperature=0.6,
top_k=30,
eos_token_id=0,
)
print(tokenizer.decode(out[0]))
- Downloads last month
- 36