Instructions to use raxtemur/sonar-llm-39m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use raxtemur/sonar-llm-39m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="raxtemur/sonar-llm-39m")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("raxtemur/sonar-llm-39m", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use raxtemur/sonar-llm-39m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "raxtemur/sonar-llm-39m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "raxtemur/sonar-llm-39m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/raxtemur/sonar-llm-39m
- SGLang
How to use raxtemur/sonar-llm-39m 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 "raxtemur/sonar-llm-39m" \ --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": "raxtemur/sonar-llm-39m", "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 "raxtemur/sonar-llm-39m" \ --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": "raxtemur/sonar-llm-39m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use raxtemur/sonar-llm-39m with Docker Model Runner:
docker model run hf.co/raxtemur/sonar-llm-39m
SONAR-LLM (39M)
We present SONAR-LLM, a decoder-only transformer that "thinks" in the same continuous SONAR embedding space, yet is supervised through token-level cross-entropy propagated via the frozen SONAR decoder. This hybrid objective retains the semantic abstraction of LCM while eliminating its diffusion sampler and restoring a likelihood-based training signal. Across model sizes from 39M to 1.3B parameters, SONAR-LLM attains competitive generation quality.
Original repository: FusionBrainLab/SONAR-LLM
Paper: arXiv:2508.05305
Minimal bundle with SONAR-LLM 39M checkpoint and code.
Install
- Use a fresh venv/conda
- Install SONAR from the official repo: facebookresearch/SONAR
- Ensure PyTorch and transformers are installed
- (Optional) Download NLTK punkt:
python -c "import nltk; nltk.download('punkt')"
Usage
from huggingface_hub import snapshot_download
import sys
p = snapshot_download("raxtemur/sonar-llm-39m")
sys.path.insert(0, p)
from sonarllm_model import SONARLLMGenerator, SONARLLMGenerationConfig
gen = SONARLLMGenerator.load_from_checkpoint(p)
eos_emb = gen.t2vec.predict(["End of sequence."], source_lang="eng_Latn").to(gen.device)
cfg = SONARLLMGenerationConfig(temperature=0)
print(gen.generate("Once upon a time", eos_emb, cfg))
Files
pytorch_model.binconfig.jsonsonarllm_model/
Notes
- SONAR install guide: facebookresearch/SONAR
- Tokenizer name is taken from
config.json.
- Downloads last month
- 9