Downloads · 30 days
932
20% of all-time downloads
HuggingFaceTB/nanowhale-100m-base
nanowhale-100m-base is a text generation model from HuggingFaceTB. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A small ~110M parameter language model implementing the DeepSeek-V4 architecture from scratch. This is the pretrained base model — see HuggingFaceTB/nanowhale-100m for the SFT/chat version.
Downloads · 30 days
932
20% of all-time downloads
All-time downloads
4.7K
Public
Parameters
110M
883 MB on disk
Likes
24
Public
Click a slice to open those files.
.safetensors442 MB · 98%
From the Hugging Face model README
A small ~110M parameter language model implementing the DeepSeek-V4 architecture from scratch. This is the pretrained base model — see HuggingFaceTB/nanowhale-100m for the SFT/chat version.
Training code: github.com/huggingface/nanowhale
This model implements key DeepSeek-V4 innovations at a miniature scale:
| Component | Details |
|---|---|
| Parameters | ~110M total (41M embeddings, 69M non-embedding) |
| Hidden size | 320 |
| Layers | 8 |
| Attention heads | 8 (1 KV head — MQA-style) |
| Head dim | 96 (32 RoPE + 64 NoPE) |
| MLA | q_lora_rank=160, o_groups=2, o_lora_rank=80 |
| MoE | 4 routed experts + 1 shared, top-2 routing |
| Expert FFN | SwiGLU, intermediate_size=640 |
| Routing | sqrtsoftplus scoring, noaux_tc method |
| Hyper-Connections | hc_mult=4, Sinkhorn routing (2 iters) |
| MTP | 1 next-token prediction layer |
| Vocab | 129,280 (DeepSeek-V4 tokenizer) |
| Context | 2,048 tokens |
| Metric | Value |
|---|---|
| Final loss | ~5.3 (cross-entropy) |
| Final entropy | 3.77 |
| Token accuracy | 33.8% |
import torch
from safetensors.torch import load_file
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
from huggingface_hub import hf_hub_download
# Load model (recommended: manual load for reliability)
config = AutoConfig.from_pretrained("HuggingFaceTB/nanowhale-100m-base", trust_remote_code=True)
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True).float()
# Download and load weights
weights_path = hf_hub_download("HuggingFaceTB/nanowhale-100m-base", "model.safetensors")
state_dict = load_file(weights_path)
model.load_state_dict(state_dict, strict=True)
model = model.cuda().eval()
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/nanowhale-100m-base")
# Generate
input_ids = tokenizer.encode("The meaning of life is", return_tensors="pt").cuda()
output = model.generate(input_ids, max_new_tokens=100, temperature=0.7, top_p=0.9,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(output[0], skip_special_tokens=True))
trust_remote_code=TrueApache-2.0