Views
No views yet
HuggingFaceTB/SmolLM3-3B-Base trained with SFT on HuggingFaceTB/smoltalk2_everyday_convs_think, then merged into a single checkpoint for easy inference.peft’s merge_and_unload1from transformers import pipeline
2
3question = "If you could instantly master any skill, what would it be and why?"
4pipe = pipeline(
5 "text-generation",
6 model="lukmanaj/smollm3-sft-colab-merged",
7 device_map="auto"
8)
9
10out = pipe(
11 [{"role": "user", "content": question}],
12 max_new_tokens=128,
13 return_full_text=False,
14 do_sample=True
15)[0]["generated_text"]
16
17print(out)Tip: For CPU-only, drop device_map. For smaller memory, try torch_dtype="auto" and low_cpu_mem_usage=True in from_pretrained.
1Copy code
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4import torch
5
6base = "HuggingFaceTB/SmolLM3-3B-Base"
7adapters = "lukmanaj/smollm3-sft-colab"
8
9model = AutoModelForCausalLM.from_pretrained(
10 base, torch_dtype=torch.bfloat16, device_map="auto"
11)
12model = PeftModel.from_pretrained(model, adapters)
13model = model.merge_and_unload() # bake LoRA into the base
14
15tok = AutoTokenizer.from_pretrained(base, use_fast=True)
16model.save_pretrained("./smollm3-sft-merged", safe_serialization=True)
17tok.save_pretrained("./smollm3-sft-merged")1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}