Text Generation
Transformers
Safetensors
laguna
laguna-s-2.1
vllm
quantized
rfa
4-bit precision
conversational
custom_code
8-bit precision
Instructions to use tcclaviger/Laguna-S-2.1-RFA_L with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tcclaviger/Laguna-S-2.1-RFA_L with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tcclaviger/Laguna-S-2.1-RFA_L", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tcclaviger/Laguna-S-2.1-RFA_L", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("tcclaviger/Laguna-S-2.1-RFA_L", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tcclaviger/Laguna-S-2.1-RFA_L with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tcclaviger/Laguna-S-2.1-RFA_L" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tcclaviger/Laguna-S-2.1-RFA_L", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tcclaviger/Laguna-S-2.1-RFA_L
- SGLang
How to use tcclaviger/Laguna-S-2.1-RFA_L 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 "tcclaviger/Laguna-S-2.1-RFA_L" \ --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": "tcclaviger/Laguna-S-2.1-RFA_L", "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 "tcclaviger/Laguna-S-2.1-RFA_L" \ --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": "tcclaviger/Laguna-S-2.1-RFA_L", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tcclaviger/Laguna-S-2.1-RFA_L with Docker Model Runner:
docker model run hf.co/tcclaviger/Laguna-S-2.1-RFA_L
| === Laguna-S-2.1-RFA === | |
| arch: laguna | |
| codebook: [-127, -104, -83, -65, -49, -35, -22, -10, 1, 13, 25, 38, 53, 69, 89, 113] | |
| rotation: hadamard16 | |
| [integrity] shards=13 missing=none | |
| [integrity] index total_size=71.16GB on-disk safetensors sum=71.17GB | |
| [integrity] tensors: index=109249 headers=109249 OK | |
| [coverage] quantized expert-mods=0 linear-mods=36240 fp16-protected=0 copied=529 | |
| [coverage] missing/bad: 0 | |
| [bpw] quant-target params=114.10B rfa bytes=64.25GB -> 4.504 bits/weight | |
| [size] total=71.16GB = rfa 64.25GB + copied(bf16/other) 6.91GB | |
| [fidelity] dequant vs source (relFro / SQNR): | |
| model.layers.0.mlp.down_proj relFro=6.150% SQNR=24.2 dB | |
| model.layers.0.mlp.gate_proj relFro=6.311% SQNR=24.0 dB | |
| model.layers.0.mlp.up_proj relFro=6.304% SQNR=24.0 dB | |
| model.layers.24.mlp.experts.0.down_proj relFro=6.328% SQNR=24.0 dB | |
| model.layers.24.mlp.experts.0.gate_proj relFro=6.334% SQNR=24.0 dB | |
| model.layers.24.mlp.experts.0.up_proj relFro=6.335% SQNR=24.0 dB | |
| model.layers.47.mlp.experts.0.down_proj relFro=6.338% SQNR=24.0 dB | |
| model.layers.47.mlp.experts.0.gate_proj relFro=6.340% SQNR=24.0 dB | |
| model.layers.47.mlp.experts.0.up_proj relFro=6.336% SQNR=24.0 dB | |
| DONE | |