Instructions to use HuggingFaceTB/SmolLM-135M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceTB/SmolLM-135M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceTB/SmolLM-135M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/SmolLM-135M") model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-135M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HuggingFaceTB/SmolLM-135M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceTB/SmolLM-135M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceTB/SmolLM-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceTB/SmolLM-135M
- SGLang
How to use HuggingFaceTB/SmolLM-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 "HuggingFaceTB/SmolLM-135M" \ --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/SmolLM-135M", "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/SmolLM-135M" \ --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/SmolLM-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceTB/SmolLM-135M with Docker Model Runner:
docker model run hf.co/HuggingFaceTB/SmolLM-135M
Update README.md
Browse files
README.md
CHANGED
|
@@ -87,19 +87,16 @@ Memory footprint: 162.87 MB
|
|
| 87 |
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
| 88 |
Memory footprint: 109.78 MB
|
| 89 |
```
|
| 90 |
-
### Attribution & Other Requirements
|
| 91 |
-
|
| 92 |
-
The pretraining dataset of the model was filtered for permissive licenses and code with no license only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected. We provide a [search index](https://huggingface.co/spaces/bigcode/search-v2) that lets you search through the pretraining data to identify where the generated code came from, and apply the proper attribution to your code.
|
| 93 |
|
| 94 |
# Limitations
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
# Training
|
| 99 |
|
| 100 |
## Model
|
| 101 |
|
| 102 |
-
- **Architecture:**
|
| 103 |
- **Pretraining steps:** 600k
|
| 104 |
- **Pretraining tokens:** 600B
|
| 105 |
- **Precision:** bfloat16
|
|
|
|
| 87 |
>>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
|
| 88 |
Memory footprint: 109.78 MB
|
| 89 |
```
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
# Limitations
|
| 92 |
|
| 93 |
+
While SmolLM models have been trained on a diverse dataset including educational content and synthetic texts, they have limitations. The models primarily understand and generate content in English. They can produce text on a variety of topics, but the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data. These models should be used as assistive tools rather than definitive sources of information. Users should always verify important information and critically evaluate any generated content. For a more comprehensive discussion of the models' capabilities and limitations, please refer to our full blog post.
|
| 94 |
|
| 95 |
# Training
|
| 96 |
|
| 97 |
## Model
|
| 98 |
|
| 99 |
+
- **Architecture:** For architecture detail, see the blog post
|
| 100 |
- **Pretraining steps:** 600k
|
| 101 |
- **Pretraining tokens:** 600B
|
| 102 |
- **Precision:** bfloat16
|