Instructions to use Fu01978/SmolLM2-135M-Instruct-AO3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Fu01978/SmolLM2-135M-Instruct-AO3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Fu01978/SmolLM2-135M-Instruct-AO3") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Fu01978/SmolLM2-135M-Instruct-AO3") model = AutoModelForCausalLM.from_pretrained("Fu01978/SmolLM2-135M-Instruct-AO3") 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 Settings
- vLLM
How to use Fu01978/SmolLM2-135M-Instruct-AO3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Fu01978/SmolLM2-135M-Instruct-AO3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Fu01978/SmolLM2-135M-Instruct-AO3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Fu01978/SmolLM2-135M-Instruct-AO3
- SGLang
How to use Fu01978/SmolLM2-135M-Instruct-AO3 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 "Fu01978/SmolLM2-135M-Instruct-AO3" \ --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": "Fu01978/SmolLM2-135M-Instruct-AO3", "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 "Fu01978/SmolLM2-135M-Instruct-AO3" \ --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": "Fu01978/SmolLM2-135M-Instruct-AO3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Fu01978/SmolLM2-135M-Instruct-AO3 with Docker Model Runner:
docker model run hf.co/Fu01978/SmolLM2-135M-Instruct-AO3
SmolLM2-135M-Instruct-AO3
This model is a fine-tuned version of HuggingFaceTB/SmolLM2-135M-Instruct trained on the Fu01978/ao3_chat dataset.
It is designed to blend the instruction-following capabilities of SmolLM2 with the descriptive, narrative, and atmospheric prose styles commonly found in creative writing communities.
Model Description
- Model type: Causal Language Model (Fine-tuned)
- Language(s) (NLP): English
- License: Apache 2.0
- Finetuned from model: HuggingFaceTB/SmolLM2-135M-Instruct
Training Details
The model was fine-tuned for a short duration to "infuse" the base model with narrative flair without completely overwriting its general knowledge.
Training Hyperparameters
- Steps: 75
- Learning Rate: 5e-4
- Batch Size: 8
- Gradient Accumulation Steps: 2
- LR Scheduler Type: linear
- Precision: FP32 (Full Precision)
Loss Curve
The model showed a rapid descent in the first 20 steps, eventually stabilizing around a loss of 2.5-2.6.
| Step | Training Loss |
|---|---|
| 5 | 3.572342 |
| 15 | 2.720610 |
| 30 | 2.497861 |
| 45 | 2.626326 |
| 60 | 2.708193 |
| 75 | 2.637797 |
Usage
This model uses the ChatML template. It is recommended to use the apply_chat_template method for best results.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Fu01978/SmolLM2-135M-Instruct-AO3"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32, device_map="auto")
messages = [
{"role": "system", "content": "You are a creative writing assistant."},
{"role": "user", "content": "Write a scene about a rainy library."},
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=150, do_sample=True, temperature=0.7)
print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
Intended Use & Limitations
- Roleplay & Fiction: Best suited for creative prompts and stylistic prose.
- Domain Shift: While it retains general knowledge, its explanations (e.g., science) may adopt a more narrative or "story-like" tone.
- Downloads last month
- 2
Model tree for Fu01978/SmolLM2-135M-Instruct-AO3
Base model
HuggingFaceTB/SmolLM2-135M