Instructions to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq 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-int4-hqq 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-int4-hqq", 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-int4-hqq", 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-int4-hqq 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-int4-hqq" # 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-int4-hqq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq
- SGLang
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq 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-int4-hqq" \ --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-int4-hqq", "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-int4-hqq" \ --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-int4-hqq", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq with Docker Model Runner:
docker model run hf.co/EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq
Laguna-XS.2 → Dense (K=8) · CUDA-SFT · HQQ 4-bit
Quantized variant of
EvanOLeary/laguna-xs2-dense-k8-cuda-sft. 4-bit weight quantization via HQQ (Half-Quadratic Quantization). Pure-PyTorch, data-free, no calibration set required.
Size & quality
| bf16 (base) | HQQ 4-bit | |
|---|---|---|
| Weight file | 5.99 GB | 2.28 GB (38% of bf16) |
| VRAM (loaded) | 6.00 GB | 2.28 GB |
| Bits/param (effective) | 16 | ~4.5 (incl. group scales + zeros) |
ReLU CUDA kernel smoke test (greedy decode, 400 max_new_tokens)
302 tokens generated in 51.7s = 5.8 tok/s.
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-int4-hqq"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
from hqq.models.hf.base import AutoHQQHFModel
model = AutoHQQHFModel.from_quantized(repo, compute_dtype=torch.bfloat16, device="cuda")
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: HQQ 4-bit | EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq |
Quantization details
- Library: hqq 0.2.8 Half-Quadratic Quantization
- Scheme: 4-bit weight-only, group_size=64, axis=1
- Calibration: none (data-free; HQQ optimizes per-tensor quantization params analytically)
- Verification: smoke test produces valid CUDA kernel code on the ReLU prompt (see snapshot in this card)
- Downloads last month
- 10
Model tree for EvanOLeary/laguna-xs2-dense-k8-cuda-sft-int4-hqq
Base model
poolside/Laguna-XS.2