Text Generation
Transformers
Safetensors
English
Arabic
quasar_long
silx-ai
quasar-preview
quasar
foundation-model
Mixture of Experts
18b
2b-active
long-context
bittensor
sn24
decentralized-training
distillation
hybrid-transformer
loop-transformer
safe-nope
drope
conversational
custom_code
Instructions to use silx-ai/Quasar-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use silx-ai/Quasar-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="silx-ai/Quasar-Preview", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("silx-ai/Quasar-Preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use silx-ai/Quasar-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "silx-ai/Quasar-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "silx-ai/Quasar-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/silx-ai/Quasar-Preview
- SGLang
How to use silx-ai/Quasar-Preview 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 "silx-ai/Quasar-Preview" \ --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": "silx-ai/Quasar-Preview", "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 "silx-ai/Quasar-Preview" \ --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": "silx-ai/Quasar-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use silx-ai/Quasar-Preview with Docker Model Runner:
docker model run hf.co/silx-ai/Quasar-Preview
| # Copyright (c) 2023-2025, Songlin Yang, Yu Zhang | |
| import torch | |
| import triton | |
| import triton.language as tl | |
| from fla.ops.utils import prepare_chunk_indices | |
| from fla.ops.utils.op import exp | |
| from fla.utils import autotune_cache_kwargs | |
| def chunk_scaled_dot_kkt_fwd_kernel( | |
| k, | |
| g, | |
| beta, | |
| A, | |
| cu_seqlens, | |
| chunk_indices, | |
| T, | |
| H: tl.constexpr, | |
| K: tl.constexpr, | |
| BT: tl.constexpr, | |
| BK: tl.constexpr, | |
| IS_VARLEN: tl.constexpr, | |
| USE_G: tl.constexpr, | |
| ): | |
| i_t, i_bh = tl.program_id(0), tl.program_id(1) | |
| i_b, i_h = i_bh // H, i_bh % H | |
| if IS_VARLEN: | |
| i_n, i_t = tl.load(chunk_indices + i_t * 2).to(tl.int32), tl.load(chunk_indices + i_t * 2 + 1).to(tl.int32) | |
| bos, eos = tl.load(cu_seqlens + i_n).to(tl.int32), tl.load(cu_seqlens + i_n + 1).to(tl.int32) | |
| T = eos - bos | |
| else: | |
| bos, eos = i_b * T, i_b * T + T | |
| o_t = i_t * BT + tl.arange(0, BT) | |
| m_t = o_t < T | |
| p_b = tl.make_block_ptr(beta + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| b_b = tl.load(p_b, boundary_check=(0,)) | |
| b_A = tl.zeros([BT, BT], dtype=tl.float32) | |
| for i_k in range(tl.cdiv(K, BK)): | |
| p_k = tl.make_block_ptr(k + (bos*H + i_h) * K, (T, K), (H*K, 1), (i_t * BT, i_k * BK), (BT, BK), (1, 0)) | |
| b_k = tl.load(p_k, boundary_check=(0, 1)) | |
| b_A += tl.dot(b_k, tl.trans(b_k)) | |
| if USE_G: | |
| p_g = tl.make_block_ptr(g + bos*H + i_h, (T,), (H,), (i_t * BT,), (BT,), (0,)) | |
| b_g = tl.load(p_g, boundary_check=(0,)) | |
| b_g_diff = b_g[:, None] - b_g[None, :] | |
| b_A *= exp(b_g_diff) | |
| b_A *= b_b[:, None] | |
| m_A = (o_t[:, None] > o_t[None, :]) & (m_t[:, None] & m_t) | |
| b_A = tl.where(m_A, b_A, 0) | |
| p_A = tl.make_block_ptr(A + (bos*H + i_h) * BT, (T, BT), (BT*H, 1), (i_t * BT, 0), (BT, BT), (1, 0)) | |
| tl.store(p_A, b_A.to(p_A.dtype.element_ty), boundary_check=(0, 1)) | |
| def chunk_scaled_dot_kkt_fwd( | |
| k: torch.Tensor, | |
| g: torch.Tensor | None = None, | |
| beta: torch.Tensor | None = None, | |
| cu_seqlens: torch.LongTensor | None = None, | |
| chunk_size: int = 64, | |
| output_dtype: torch.dtype = torch.float32, | |
| chunk_indices: torch.LongTensor | None = None, | |
| ) -> torch.Tensor: | |
| r""" | |
| Compute beta * K * K^T. | |
| Args: | |
| k (torch.Tensor): | |
| The key tensor of shape `[B, T, H, K]`. | |
| beta (torch.Tensor): | |
| The beta tensor of shape `[B, T, H]`. | |
| g (torch.Tensor): | |
| The cumulative sum of the gate tensor of shape `[B, T, H]`. Default: `None`. | |
| gk (torch.Tensor): | |
| The cumulative sum of the gate tensor of shape `[B, T, H, K]` applied to the key tensor. Default: `None`. | |
| cu_seqlens (torch.LongTensor): | |
| The cumulative sequence lengths of the input tensor. | |
| Default: None | |
| chunk_size (int): | |
| The chunk size. Default: 64. | |
| output_dtype (torch.dtype): | |
| The dtype of the output tensor. Default: `torch.float32` | |
| Returns: | |
| beta * K * K^T of shape `[B, T, H, BT]` where `BT` is the chunk size. | |
| """ | |
| B, T, H, K = k.shape | |
| BT = chunk_size | |
| if chunk_indices is None and cu_seqlens is not None: | |
| chunk_indices = prepare_chunk_indices(cu_seqlens, BT) | |
| NT = triton.cdiv(T, BT) if cu_seqlens is None else len(chunk_indices) | |
| A = torch.empty(B, T, H, BT, device=k.device, dtype=output_dtype) | |
| chunk_scaled_dot_kkt_fwd_kernel[(NT, B * H)]( | |
| k=k, | |
| g=g, | |
| beta=beta, | |
| A=A, | |
| cu_seqlens=cu_seqlens, | |
| chunk_indices=chunk_indices, | |
| T=T, | |
| H=H, | |
| K=K, | |
| BT=BT, | |
| ) | |
| return A | |