Instructions to use Soulitude/Hush-Nano with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Soulitude/Hush-Nano with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Soulitude/Hush-Nano", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Soulitude/Hush-Nano", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Soulitude/Hush-Nano with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Soulitude/Hush-Nano" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Soulitude/Hush-Nano", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Soulitude/Hush-Nano
- SGLang
How to use Soulitude/Hush-Nano 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 "Soulitude/Hush-Nano" \ --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": "Soulitude/Hush-Nano", "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 "Soulitude/Hush-Nano" \ --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": "Soulitude/Hush-Nano", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Soulitude/Hush-Nano with Docker Model Runner:
docker model run hf.co/Soulitude/Hush-Nano
Hush-Nano
Hush-Nano is a 22M decoder-only small language model trained from scratch on an 8.5B token corpus.
This is a base model, not an instruction-tuned chat model.
Model Details
Hush-Nano has the following features:
- Type: Causal Language Models
- Training Stage: Pretraining
- Architecture: transformers with RMSNorm, RoPE, SwiGLU, QK-Norm and tied word embeddings
- Number of Parameters: 22M (22,621,056)
- Number of Layers: 12
- Number of Attention Heads (GQA): 6 for Q and 3 for KV
- Context Length: 1,024
It is not recommended to use this model for conversations. Instead, you can apply post-training, e.g., SFT, RLHF, continued pretraining, etc., on this model.
Training Data
The model was trained on an 8.5B (8,554,042,292) token subset of the following subsets:
| Source | Training tokens | Share |
|---|---|---|
| FineWeb-Edu | 4,539,286,619 | 53.07% |
| DCLM | 2,890,209,171 | 33.79% |
| FineMath4plus | 1,124,546,502 | 13.15% |
Evaluation
Zero-shot normalized accuracy, evaluated in fp32 using EleutherAI/lm-evaluation-harness. Scores may vary slightly with the evaluation setup and environment.
| PIQA | ARC-Easy | ARC-Challenge | HellaSwag | |
|---|---|---|---|---|
| Hush-Nano | 58.27% | 38.93% | 21.84% | 28.89% |
Usage
This model includes custom Transformers code and so requires trust_remote_code=True.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "Soulitude/Hush-Nano"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
)
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device).eval()
prompt = "Every effort makes you"
inputs = tokenizer(
prompt,
return_tensors="pt",
add_special_tokens=False,
).to(device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.95,
repetition_penalty=1.1,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Intended Use and Limitations
Hush-Nano is intended for small language model research, text continuation, and evaluation of pretrained model behavior. It has not been instruction-tuned and may not follow conversational instructions reliably. Its configured maximum context length is 1,024 tokens.
License
Apache 2.0
- Downloads last month
- 9
