Instructions to use mlabonne/SmolGRPO-135M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/SmolGRPO-135M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/SmolGRPO-135M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlabonne/SmolGRPO-135M") model = AutoModelForCausalLM.from_pretrained("mlabonne/SmolGRPO-135M", device_map="auto") 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 mlabonne/SmolGRPO-135M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/SmolGRPO-135M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/SmolGRPO-135M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlabonne/SmolGRPO-135M
- SGLang
How to use mlabonne/SmolGRPO-135M 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 "mlabonne/SmolGRPO-135M" \ --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": "mlabonne/SmolGRPO-135M", "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 "mlabonne/SmolGRPO-135M" \ --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": "mlabonne/SmolGRPO-135M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mlabonne/SmolGRPO-135M with Docker Model Runner:
docker model run hf.co/mlabonne/SmolGRPO-135M
SmolGRPO-135M
This is a fine-tune of HuggingFaceTB/SmolLM2-135M-Instruct using GRPO on mlabonne/smoltldr (2k samples). It is designed to summarize Reddit posts using ~50 characters.
You can reproduce this training using this colab notebook. It takes about 40 minutes to train the model.
Takeaways from these experiments:
- Adding a system prompt like "Summarize the following text concisely" doesn't help
- You can get faster convergence with a higher learning rate and fewer samples, but it's prone to overshooting your target.
- I tried many reward functions to play with reward shaping but it didn't seem to help
Example
Input:
SUBREDDIT: r/Advice
TITLE: I have big dreams and goals, but they are kind of cloudy.[m20]
POST: I live at home with my family right now and I don't go to school. I went to college for a year and decided to stop. My best friend convinced me that I don't need college to do what I want to do. Besides, I hated taking classes I wasn't interested in. The things I want to do in life (I know it seems like too much) included producing music, making a cartoon, making comics, designing clothes and shoes, and other smaller things related to that. I grew up with a good family with a father that had similar dreams. He niw has a job he's been working for 20+ years that he doesn't like. I too am afraid of falling into that path. I've been pretty down and frustrated and feeling things are quite impossible although I know there's always hope. I don't really want to do anything else, but I'm stuck. I'll be pretty down for a week, then by the next week I'm in high spirits with a game plan that always fails. I've been doing this for quite a while now. My parents are starting to get on my case now and when they ask what I'm gonna do in life I don't know how to respond. Maybe I should try looking for lessons in nyc to get me out of the house? I practice drawing and making music a lot, but I can never feel satisfied and feel like I'm moving in the right direction. Everything seems like a scary cycle of ups and downs. I have faith I can turn it around, but I just don't know how.
TL;DR:
Output:
I have big dreams and goals, but they are kind of cloudy. I'm going to try to figure out a plan to get out of that house, but I'm not sure what that plan will be.
- Downloads last month
- 12