Instructions to use sapbot/gemma-3n-4b-it-distill-smollm2-360m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use sapbot/gemma-3n-4b-it-distill-smollm2-360m with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/SmolLM2-360M-Instruct") model = PeftModel.from_pretrained(base_model, "sapbot/gemma-3n-4b-it-distill-smollm2-360m") - Transformers
How to use sapbot/gemma-3n-4b-it-distill-smollm2-360m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sapbot/gemma-3n-4b-it-distill-smollm2-360m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sapbot/gemma-3n-4b-it-distill-smollm2-360m", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sapbot/gemma-3n-4b-it-distill-smollm2-360m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sapbot/gemma-3n-4b-it-distill-smollm2-360m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sapbot/gemma-3n-4b-it-distill-smollm2-360m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sapbot/gemma-3n-4b-it-distill-smollm2-360m
- SGLang
How to use sapbot/gemma-3n-4b-it-distill-smollm2-360m 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 "sapbot/gemma-3n-4b-it-distill-smollm2-360m" \ --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": "sapbot/gemma-3n-4b-it-distill-smollm2-360m", "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 "sapbot/gemma-3n-4b-it-distill-smollm2-360m" \ --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": "sapbot/gemma-3n-4b-it-distill-smollm2-360m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sapbot/gemma-3n-4b-it-distill-smollm2-360m with Docker Model Runner:
docker model run hf.co/sapbot/gemma-3n-4b-it-distill-smollm2-360m
| [INFO|2026-05-08 20:51:45] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 20:51:45] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 20:51:47] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 20:51:47] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 20:51:47] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 20:51:47] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 20:51:49] logging.py:144 >> Add <|im_end|> to stop words. | |
| [INFO|2026-05-08 20:51:49] logging.py:144 >> Loading dataset sapbot/gemma-3n-4b-it-423x... | |
| [INFO|2026-05-08 20:51:51] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 20:51:51] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 20:51:51] logging.py:144 >> KV cache is disabled during training. | |
| [INFO|2026-05-08 20:51:52] modeling_utils.py:710 >> loading weights file model.safetensors from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/model.safetensors | |
| [INFO|2026-05-08 20:51:52] modeling_utils.py:779 >> Will use dtype=torch.bfloat16 as defined in model's config object | |
| [INFO|2026-05-08 20:51:52] configuration_utils.py:1014 >> Generate config GenerationConfig { | |
| "bos_token_id": 1, | |
| "eos_token_id": 2, | |
| "output_attentions": false, | |
| "output_hidden_states": false, | |
| "pad_token_id": 49152, | |
| "use_cache": false | |
| } | |
| [INFO|2026-05-08 20:51:53] configuration_utils.py:967 >> loading configuration file generation_config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/generation_config.json | |
| [INFO|2026-05-08 20:51:53] configuration_utils.py:1014 >> Generate config GenerationConfig { | |
| "bos_token_id": 1, | |
| "eos_token_id": 2, | |
| "max_length": 8192, | |
| "pad_token_id": 49152 | |
| } | |
| [INFO|2026-05-08 20:51:54] dynamic_module_utils.py:406 >> Could not locate the custom_generate/generate.py inside unsloth/SmolLM2-360M-Instruct. | |
| [INFO|2026-05-08 20:51:54] logging.py:144 >> Gradient checkpointing enabled. | |
| [INFO|2026-05-08 20:51:54] logging.py:144 >> Using torch SDPA for faster training and inference. | |
| [INFO|2026-05-08 20:51:54] logging.py:144 >> Upcasting trainable params to float32. | |
| [INFO|2026-05-08 20:51:54] logging.py:144 >> Fine-tuning method: LoRA | |
| [INFO|2026-05-08 20:51:54] logging.py:144 >> Found linear modules: o_proj,q_proj,down_proj,v_proj,k_proj,up_proj,gate_proj | |
| [INFO|2026-05-08 20:51:56] logging.py:144 >> trainable params: 4,341,760 || all params: 366,163,840 || trainable%: 1.1857 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1587 >> ***** Running training ***** | |
| [INFO|2026-05-08 20:51:56] trainer.py:1588 >> Num examples = 423 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1589 >> Num Epochs = 3 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1590 >> Instantaneous batch size per device = 2 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1593 >> Total train batch size (w. parallel, distributed & accumulation) = 16 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1594 >> Gradient Accumulation steps = 8 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1595 >> Total optimization steps = 81 | |
| [INFO|2026-05-08 20:51:56] trainer.py:1596 >> Number of trainable parameters = 4,341,760 | |
| [INFO|2026-05-08 20:53:35] logging.py:144 >> {'loss': 4.6997, 'learning_rate': 4.9981e-05, 'epoch': 0.19, 'throughput': 933.89} | |
| [INFO|2026-05-08 20:55:17] logging.py:144 >> {'loss': 10.7092, 'learning_rate': 4.9981e-05, 'epoch': 0.38, 'throughput': 954.01} | |
| [INFO|2026-05-08 20:56:59] logging.py:144 >> {'loss': 11.7926, 'learning_rate': 4.9981e-05, 'epoch': 0.57, 'throughput': 958.84} | |
| [INFO|2026-05-08 20:58:39] logging.py:144 >> {'loss': 13.5184, 'learning_rate': 4.9925e-05, 'epoch': 0.75, 'throughput': 956.42} | |
| [INFO|2026-05-08 21:00:25] logging.py:144 >> {'loss': 20.1784, 'learning_rate': 4.9925e-05, 'epoch': 0.94, 'throughput': 959.60} | |
| [INFO|2026-05-08 21:02:09] logging.py:144 >> {'loss': 7.2012, 'learning_rate': 4.9831e-05, 'epoch': 1.11, 'throughput': 953.38} | |
| [INFO|2026-05-08 21:03:58] logging.py:144 >> {'loss': 16.0000, 'learning_rate': 4.9831e-05, 'epoch': 1.30, 'throughput': 952.43} | |
| [INFO|2026-05-08 21:05:50] logging.py:144 >> {'loss': 9.6828, 'learning_rate': 4.9831e-05, 'epoch': 1.49, 'throughput': 951.69} | |
| [INFO|2026-05-08 21:07:46] logging.py:144 >> {'loss': 6.1018, 'learning_rate': 4.9831e-05, 'epoch': 1.68, 'throughput': 950.28} | |
| [INFO|2026-05-08 21:09:18] logging.py:144 >> {'loss': 10.2955, 'learning_rate': 4.9700e-05, 'epoch': 1.87, 'throughput': 953.07} | |
| [INFO|2026-05-08 21:11:03] logging.py:144 >> {'loss': 4.0894, 'learning_rate': 4.9326e-05, 'epoch': 2.04, 'throughput': 951.55} | |
| [INFO|2026-05-08 21:12:46] logging.py:144 >> {'loss': 26.6340, 'learning_rate': 4.9326e-05, 'epoch': 2.23, 'throughput': 952.42} | |
| [INFO|2026-05-08 21:14:35] logging.py:144 >> {'loss': 5.8759, 'learning_rate': 4.9084e-05, 'epoch': 2.42, 'throughput': 950.59} | |
| [INFO|2026-05-08 21:16:32] logging.py:144 >> {'loss': 4.9436, 'learning_rate': 4.9084e-05, 'epoch': 2.60, 'throughput': 947.64} | |
| [INFO|2026-05-08 21:18:21] logging.py:144 >> {'loss': 11.3494, 'learning_rate': 4.9084e-05, 'epoch': 2.79, 'throughput': 948.32} | |
| [INFO|2026-05-08 21:19:45] logging.py:144 >> {'loss': 3.3956, 'learning_rate': 4.8492e-05, 'epoch': 2.98, 'throughput': 950.90} | |
| [INFO|2026-05-08 21:19:53] trainer.py:3797 >> Saving model checkpoint to saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08/checkpoint-81 | |
| [INFO|2026-05-08 21:19:54] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 21:19:54] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 21:19:54] tokenization_utils_base.py:3224 >> chat template saved in saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08/checkpoint-81/chat_template.jinja | |
| [INFO|2026-05-08 21:19:54] tokenization_utils_base.py:2078 >> tokenizer config file saved in saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08/checkpoint-81/tokenizer_config.json | |
| [INFO|2026-05-08 21:19:54] trainer.py:1863 >> | |
| Training completed. Do not forget to share your model on huggingface.co/models =) | |
| [INFO|2026-05-08 21:19:54] trainer.py:3797 >> Saving model checkpoint to saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08 | |
| [INFO|2026-05-08 21:19:55] configuration_utils.py:670 >> loading configuration file config.json from cache at /home/sapbot/.cache/huggingface/hub/models--unsloth--SmolLM2-360M-Instruct/snapshots/7c6bf9a2faef35209646cd7f1569fae2b2394a00/config.json | |
| [INFO|2026-05-08 21:19:55] configuration_utils.py:742 >> Model config LlamaConfig { | |
| "architectures": [ | |
| "LlamaForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 1, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 2, | |
| "head_dim": 64, | |
| "hidden_act": "silu", | |
| "hidden_size": 960, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2560, | |
| "is_llama_config": true, | |
| "max_position_embeddings": 8192, | |
| "mlp_bias": false, | |
| "model_type": "llama", | |
| "num_attention_heads": 15, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 5, | |
| "pad_token_id": 49152, | |
| "pretraining_tp": 1, | |
| "rms_norm_eps": 1e-05, | |
| "rope_interleaved": false, | |
| "rope_parameters": { | |
| "rope_theta": 100000, | |
| "rope_type": "default" | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers.js_config": { | |
| "kv_cache_dtype": { | |
| "fp16": "float16", | |
| "q4f16": "float16" | |
| } | |
| }, | |
| "transformers_version": "5.2.0", | |
| "use_cache": true, | |
| "vocab_size": 49153 | |
| } | |
| [INFO|2026-05-08 21:19:55] tokenization_utils_base.py:3224 >> chat template saved in saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08/chat_template.jinja | |
| [INFO|2026-05-08 21:19:55] tokenization_utils_base.py:2078 >> tokenizer config file saved in saves/SmolLM-360M-Instruct/lora/train_2026-05-08-20-46-08/tokenizer_config.json | |
| [WARNING|2026-05-08 21:19:55] logging.py:149 >> No metric eval_loss to plot. | |
| [WARNING|2026-05-08 21:19:55] logging.py:149 >> No metric eval_accuracy to plot. | |
| [INFO|2026-05-08 21:19:55] modelcard.py:266 >> Dropping the following result as it does not have all the necessary fields: | |
| {'task': {'name': 'Causal Language Modeling', 'type': 'text-generation'}} | |