Instructions to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8
- SGLang
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 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 "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 with Docker Model Runner:
docker model run hf.co/EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8
Laguna-XS.2 → Dense (K=8) · CUDA-SFT · torchao Int8 weight-only
Quantized variant of
EvanOLeary/laguna-xs2-dense-k8-cuda-sft. Pure-PyTorch int8 weight-only quantization via torchao. Bf16 activations / compute, int8 storage. Quantization is lossless on greedy decode for the ReLU smoke prompt (byte-identical to bf16).
Size & quality
| bf16 (base) | torchao Int8 weight-only | |
|---|---|---|
| Weight file | 5.99 GB | 3.21 GB (54% of bf16) |
| VRAM (loaded) | 6.00 GB | 3.22 GB |
| Bits/param (effective) | 16 | ~8.6 (incl. scale/zero overhead) |
ReLU CUDA kernel smoke test (greedy decode, 400 max_new_tokens)
Quantization is functionally lossless on this prompt — int8 output is byte-identical to bf16 (1046 chars, 303 tokens, both greedy).
Prompt: "Write a CUDA kernel that computes ReLU (max(x, 0)) on a float array in-place. Include the kernel and a host-side launcher."
The model produced a complete torch::extension-style CUDA kernel with templated relu_kernel,
AT_DISPATCH_FLOATING_TYPES dispatch, a relu_forward host launcher, and a PYBIND11_MODULE
entrypoint suitable for torch.utils.cpp_extension.load_inline.
How to load
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True,
dtype=torch.bfloat16, device_map="cuda")
# torchao quant is baked into the saved weights — no further setup needed.
msgs = [{"role":"user","content":"Write a CUDA kernel for elementwise sigmoid on a float array."}]
text = tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)
ids = tok(text, return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)
out = model.generate(ids, max_new_tokens=400, do_sample=False, pad_token_id=tok.pad_token_id)
print(tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True))
Provenance & roadmap
| Stage | Repo |
|---|---|
| Teacher MoE | poolside/Laguna-XS.2 |
| Dense recon (V1) | EvanOLeary/laguna-xs2-dense-k8-recon |
| CUDA-SFT (bf16 base for this quant) | EvanOLeary/laguna-xs2-dense-k8-cuda-sft |
| This: torchao Int8 weight-only | EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8 |
Quantization details
- Library: torchao 0.17.0
Int8WeightOnlyConfig - Scheme: symmetric per-channel int8 weight quantization, bf16 activations & computation
- Calibration: none (PTQ on weights only)
- Quantize time: 0.4 s after model load
- Verification: bf16 vs int8 produce byte-identical 1046-char output on the ReLU prompt (greedy decode)
- Inference cost: dequantize-on-the-fly to bf16 per matmul → ~1.34× slower wall-clock than bf16 on A100 (14.8 → 9.8 tok/s).
torch.compileshould close this gap.
- Downloads last month
- 21
Model tree for EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int8
Base model
poolside/Laguna-XS.2