Text Generation
Transformers
Safetensors
llama
smol-course
module_1
trl
sft
Generated from Trainer
conversational
text-generation-inference
Instructions to use puettmann/SmolLM2-135M-Instruct-Smol-Course with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use puettmann/SmolLM2-135M-Instruct-Smol-Course with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="puettmann/SmolLM2-135M-Instruct-Smol-Course") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("puettmann/SmolLM2-135M-Instruct-Smol-Course") model = AutoModelForCausalLM.from_pretrained("puettmann/SmolLM2-135M-Instruct-Smol-Course") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use puettmann/SmolLM2-135M-Instruct-Smol-Course with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "puettmann/SmolLM2-135M-Instruct-Smol-Course" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "puettmann/SmolLM2-135M-Instruct-Smol-Course", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/puettmann/SmolLM2-135M-Instruct-Smol-Course
- SGLang
How to use puettmann/SmolLM2-135M-Instruct-Smol-Course 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 "puettmann/SmolLM2-135M-Instruct-Smol-Course" \ --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": "puettmann/SmolLM2-135M-Instruct-Smol-Course", "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 "puettmann/SmolLM2-135M-Instruct-Smol-Course" \ --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": "puettmann/SmolLM2-135M-Instruct-Smol-Course", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use puettmann/SmolLM2-135M-Instruct-Smol-Course with Docker Model Runner:
docker model run hf.co/puettmann/SmolLM2-135M-Instruct-Smol-Course
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("puettmann/SmolLM2-135M-Instruct-Smol-Course")
model = AutoModelForCausalLM.from_pretrained("puettmann/SmolLM2-135M-Instruct-Smol-Course")
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]:]))Quick Links
SmolLM2-FT
This model is a fine-tuned version of HuggingFaceTB/SmolLM2-135M on an unknown dataset. It achieves the following results on the evaluation set:
- Loss: 1.0016
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 4
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- training_steps: 1000
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.0523 | 0.0885 | 50 | 1.1397 |
| 1.096 | 0.1770 | 100 | 1.1030 |
| 1.048 | 0.2655 | 150 | 1.0750 |
| 1.0342 | 0.3540 | 200 | 1.0596 |
| 1.0262 | 0.4425 | 250 | 1.0505 |
| 1.0168 | 0.5310 | 300 | 1.0413 |
| 0.989 | 0.6195 | 350 | 1.0342 |
| 0.992 | 0.7080 | 400 | 1.0307 |
| 1.0056 | 0.7965 | 450 | 1.0224 |
| 1.0605 | 0.8850 | 500 | 1.0137 |
| 0.9758 | 0.9735 | 550 | 1.0081 |
| 0.7922 | 1.0619 | 600 | 1.0134 |
| 0.8005 | 1.1504 | 650 | 1.0096 |
| 0.7443 | 1.2389 | 700 | 1.0111 |
| 0.8439 | 1.3274 | 750 | 1.0089 |
| 0.8013 | 1.4159 | 800 | 1.0050 |
| 0.7648 | 1.5044 | 850 | 1.0054 |
| 0.8123 | 1.5929 | 900 | 1.0030 |
| 0.8511 | 1.6814 | 950 | 1.0018 |
| 0.7797 | 1.7699 | 1000 | 1.0016 |
Framework versions
- Transformers 4.45.1
- Pytorch 2.4.1+cu118
- Datasets 3.0.2
- Tokenizers 0.20.0
- Downloads last month
- 4
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="puettmann/SmolLM2-135M-Instruct-Smol-Course") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)