Instructions to use HuggingFaceTB/SmolLM3-3B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceTB/SmolLM3-3B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceTB/SmolLM3-3B-Base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM3-3B-Base") model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM3-3B-Base") - Transformers.js
How to use HuggingFaceTB/SmolLM3-3B-Base with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'HuggingFaceTB/SmolLM3-3B-Base'); - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HuggingFaceTB/SmolLM3-3B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceTB/SmolLM3-3B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceTB/SmolLM3-3B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceTB/SmolLM3-3B-Base
- SGLang
How to use HuggingFaceTB/SmolLM3-3B-Base 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 "HuggingFaceTB/SmolLM3-3B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceTB/SmolLM3-3B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "HuggingFaceTB/SmolLM3-3B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceTB/SmolLM3-3B-Base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceTB/SmolLM3-3B-Base with Docker Model Runner:
docker model run hf.co/HuggingFaceTB/SmolLM3-3B-Base
invalid username and password when push_to_hub set to true
#10
by hubsnippetai - opened
During fine-tuning, with push_to_hub set to true, push_to_hub_token specified, this error occurred
Generating table_gpt_no_think split: 100%|ββββββββββ| 13203/13203 [00:00<00:00, 198627.67 examples/s]
Generating tulu_3_sft_personas_instruction_following_no_think split: 53%|ββββββ | 16000/29970 [00:00<00:00, 156104.8Generating tulu_3_sft_personas_instruction_following_no_think split: 100%|ββββββββββ| 29970/29970 [00:00<00:00, 164501.24 examples/s]
Generating xlam_traces_no_think split: 100%|ββββββββββ| 59962/59962 [00:00<00:00, 409716.03 examples/s]
Map: 100%|ββββββββββ| 2057/2057 [00:01<00:00, 1764.20 examples/s]
Dataset sanity check passed for 5 examples. All seq_len=1024.
Truncating train dataset: 100%|ββββββββββ| 2057/2057 [00:00<00:00, 86191.50 examples/s]
Traceback (most recent call last):
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/huggingface_hub/utils/_http.py", line 407, in hf_raise_for_status
response.raise_for_status()
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/requests/models.py", line 1026, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/script.py", line 342, in <module>
trainer = SFTTrainer(
^^^^^^^^^^^
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/trl/trainer/sft_trainer.py", line 869, in __init__
super().__init__(
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/transformers/utils/deprecation.py", line 172, in wrapped_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/transformers/trainer.py", line 691, in __init__
self.init_hf_repo()
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/transformers/trainer.py", line 4964, in init_hf_repo
repo_url = create_repo(repo_name, token=token, private=self.args.hub_private_repo, exist_ok=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/huggingface_hub/hf_api.py", line 3766, in create_repo
hf_raise_for_status(r)
File "/root/.cache/uv/environments-v2/script-912247c0edd68a55/lib/python3.12/site-packages/huggingface_hub/utils/_http.py", line 480, in hf_raise_for_status
raise _format(HfHubHTTPError, str(e), response) from e
huggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/repos/create (Request ID: Root=1-68e5c777-452112025d4acbd549ec978f;775ceb4a-389e-4816-80be-0e3c65330995)
Invalid username or password.
Please what might be wrong?
hubsnippetai changed discussion status to closed
issue is resolved