CoolFace
Modelpublic

dispatchAI/SmolLM2-135M-Instruct-mobile

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes31downloads
usage_examples.py30 linesDownload Raw Back to root
1# SmolLM2-135M-Instruct-mobile — Verified Usage Examples2# Chat format: llama-33# CPU speed: 59.7 t/s4# Verified: June 20265 6# === Using dispatchai SDK ===7from dispatchai import load_model8model = load_model("SmolLM2-135M-Instruct-mobile", backend="gguf")9 10# Chat11response = model.chat("What is the capital of France?")12print(f"Capital: {response}")13 14# With system prompt15response = model.chat("Summarize this: The meeting is at 3pm.", system="You are a concise assistant.")16print(f"Summary: {response}")17 18# === Using llama-cpp-python directly ===19from llama_cpp import Llama20llm = Llama(model_path="model.gguf", chat_format="llama-3", n_ctx=512, n_threads=4, verbose=False)21 22response = llm.create_chat_completion(23    messages=[{"role": "user", "content": "What is 2+2?"}],24    max_tokens=30,25)26print(f"Math: {response['choices'][0]['message']['content']}")27 28# === Using llama.cpp CLI ===29# llama-cli -m model.gguf -p "Hello!" -n 30 -t 4 -st --chat-format llama-330