Text Generation
Transformers
TensorBoard
ONNX
Safetensors
Transformers.js
English
llama
conversational
text-generation-inference
Instructions to use viktor-shcherb/SmolLM2-360M-Tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use viktor-shcherb/SmolLM2-360M-Tools with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="viktor-shcherb/SmolLM2-360M-Tools") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("viktor-shcherb/SmolLM2-360M-Tools") model = AutoModelForCausalLM.from_pretrained("viktor-shcherb/SmolLM2-360M-Tools") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Transformers.js
How to use viktor-shcherb/SmolLM2-360M-Tools with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'viktor-shcherb/SmolLM2-360M-Tools'); - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use viktor-shcherb/SmolLM2-360M-Tools with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "viktor-shcherb/SmolLM2-360M-Tools" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "viktor-shcherb/SmolLM2-360M-Tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/viktor-shcherb/SmolLM2-360M-Tools
- SGLang
How to use viktor-shcherb/SmolLM2-360M-Tools 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 "viktor-shcherb/SmolLM2-360M-Tools" \ --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": "viktor-shcherb/SmolLM2-360M-Tools", "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 "viktor-shcherb/SmolLM2-360M-Tools" \ --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": "viktor-shcherb/SmolLM2-360M-Tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use viktor-shcherb/SmolLM2-360M-Tools with Docker Model Runner:
docker model run hf.co/viktor-shcherb/SmolLM2-360M-Tools
| { | |
| "epoch": 1.9973828840617638, | |
| "eval_logits/chosen": -1.6407532691955566, | |
| "eval_logits/rejected": -1.6968854665756226, | |
| "eval_logps/chosen": -375.6463623046875, | |
| "eval_logps/rejected": -323.7197570800781, | |
| "eval_loss": 0.6348475217819214, | |
| "eval_rewards/accuracies": 0.6190476417541504, | |
| "eval_rewards/chosen": -0.034213583916425705, | |
| "eval_rewards/margins": 0.3567626178264618, | |
| "eval_rewards/rejected": -0.3909761905670166, | |
| "eval_runtime": 22.3598, | |
| "eval_samples": 2000, | |
| "eval_samples_per_second": 89.446, | |
| "eval_steps_per_second": 2.818 | |
| } |