forked from EricLBuehler/mistral.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmollm3.py
More file actions
28 lines (24 loc) · 722 Bytes
/
smollm3.py
File metadata and controls
28 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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}")