Files
c3be7b6be4 Add the SmolLM3 model! (#1501)
* Add model

* Update loader

* Fix llama config usage

* Docs

* Fix config no_rope_layers

* Fix tie_word_embeddings default

* Add chat template

* Embed the chat templates

* Fix embedding template

* enable_thinking default true

* Update examples

* XML tools for smollm3

* Add smollm3 docs

* Fix openai examples

* Clippy

---------

Co-authored-by: Eric Buehler <[email protected]>
2025-07-08 14:48:58 -04:00

29 lines
722 B
Python

#!/usr/bin/env python
"""
Example of using SmolLM3 model with mistral.rs
"""
from mistralrs import Runner, Which, ChatCompletionRequest, Architecture
# Create a SmolLM3 model runner
runner = Runner(
which=Which.Plain(
model_id="HuggingFaceTB/SmolLM3-3B", # You can use any SmolLM3 model from HuggingFace
arch=Architecture.SmolLm3,
),
)
# Send a chat completion request
res = runner.send_chat_completion_request(
ChatCompletionRequest(
model="smollm3",
messages=[{"role": "user", "content": "What is the capital of France?"}],
max_tokens=256,
temperature=0.7,
)
)
# Print the response
print(res.choices[0].message.content)
print(f"\nUsage: {res.usage}")