Downloads · 30 days
159
38% of all-time downloads
GenakiGyoka/deepseek-v4-nano-tinystories
deepseek-v4-nano-tinystories is a text generation model from GenakiGyoka. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as mit.
DeepSeek V4-Nano is an efficient 130M-parameter Mixture-of-Experts (MoE) Large Language Model built from scratch using PyTorch. It incorporates modern LLM architectural innovations including Multi-Head Latent Attentio…
Downloads · 30 days
159
38% of all-time downloads
All-time downloads
416
Public
Repo size
520 MB
Likes
1
Public
Click a slice to open those files.
.bin520 MB · 100%
From the Hugging Face model README
DeepSeek V4-Nano is an efficient 130M-parameter Mixture-of-Experts (MoE) Large Language Model built from scratch using PyTorch. It incorporates modern LLM architectural innovations including Multi-Head Latent Attention (MLA), Auxiliary-Loss-Free Load Balancing (Bias-based routing), and a Shared + Routed Expert Architecture, trained on the TinyStories dataset (~925M tokens).
seq_len): 512 tokensdim): 512top_k): 2 routed + 1 shared0.9236Below are representative text generations from the model across different temperatures using prompt seeds:
"Once upon a time,"Temperature 0.2: "Once upon a time, there was a little girl named Lily. She loved to play outside in the sunshine. One day, she found a shiny rock on the ground. It was so pretty and smooth. She picked it up and held it in her hand. Suddenly, she heard a loud noise. It was her friend, Timmy. He was crying because he lost his toy car. Lily wanted to help him find it. She looked around and saw the toy car under a bush. She picked it up and gave it to Timmy. He was so happy and hugged her. Lily felt happy too."
Temperature 0.5: "Once upon a time, there was a little girl named Lily. She loved to play with her toys and run around in the park. One day, she saw a big dog and she wanted to pet it. But the dog was not friendly and it bit her. Lily's mom took her to the hospital and the doctor said she needed a shot. Lily was scared and didn't want the shot. She cried and cried until her mom gave her a hug and a kiss."
"Tom walked into the forest."Temperature 0.2: "Tom walked into the forest. He saw a big tree with a hole in it. Tom looked inside the hole and found a small, shiny box. He opened the box and found a note. The note said, 'To Tom, from the squirrel.' Tom was very happy and thanked the squirrel."
"The little rabbit said,"Temperature 0.5: "The little rabbit said, 'I don't like the rain, it makes me wet and cold.' The wise owl said, 'I have an idea. Let's go to my tree and stay dry.' They went to the tree and the wise owl said, 'Let's cover ourselves with my wings so we don't get wet.' The little rabbit was happy and said, 'Thank you, wise owl.'"
pip install torch tokenizers
import torch
from tokenizers import Tokenizer
from deepseek_v4 import DeepSeekV4
# Load tokenizer
tokenizer = Tokenizer.from_file("tokenizer.json")
# Model configuration
model = DeepSeekV4(
vocab_size=16384,
seq_len=512,
dim=512,
n_heads=8,
n_layers=8,
n_experts=8,
expert_hidden_dim=1024,
top_k_experts=2,
use_shared_expert=True,
load_balance_method="bias"
)
# Load weights
state_dict = torch.load("pytorch_model.bin", map_location="cpu")
model.load_state_dict(state_dict)
model.eval()
# Generate text
prompt = "Once upon a time,"
input_ids = torch.tensor([tokenizer.encode(prompt).ids])
with torch.no_grad():
output = model.generate(
input_ids,
max_new_tokens=150,
temperature=0.5,
top_k=50,
top_p=0.95
)
print(tokenizer.decode(output[0].tolist()))
This project is licensed under the MIT License - see the LICENSE file for details.