Downloads · 30 days
63
58% of all-time downloads
sukritvemula/hydra-small-tinystories
hydra-small-tinystories is a machine learning model from sukritvemula. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A novel non-transformer language model built from scratch. Trained on CPU using a custom architecture that combines Mamba's Selective State Spaces, Griffin's Real-Gated Linear Recurrence (RG-LRU), and RWKV's channel m…
Downloads · 30 days
63
58% of all-time downloads
All-time downloads
108
Public
Repo size
385 MB
Likes
0
Public
Click a slice to open those files.
.pt308 MB · 99%
From the Hugging Face model README
A novel non-transformer language model built from scratch. Trained on CPU using a custom architecture that combines Mamba's Selective State Spaces, Griffin's Real-Gated Linear Recurrence (RG-LRU), and RWKV's channel mixing — with zero attention layers.
| Component | Source | Paper |
|---|---|---|
| Selective State Spaces | Mamba | arxiv:2312.00752 |
| Real-Gated Linear Recurrence | Griffin | arxiv:2402.19427 |
| Time/Channel Mixing | RWKV | arxiv:2305.13048 |
| Multi-Scale Compression | Novel | Parallel recurrences at different timescales |
Token Embedding → N × HydraBlock → RMSNorm → LM Head
HydraBlock:
├── RMSNorm → SelectiveGatedRecurrence → + residual
└── RMSNorm → GatedChannelMixing (GeGeLU) → + residual
SelectiveGatedRecurrence (per timescale):
├── Input projection (2 branches)
├── Branch 1: Separable Conv1D → SiLU → Selective B,C projection
├── Input gate + Recurrence gate (from Griffin RG-LRU)
├── Gated recurrence: h_t = a_t·h_{t-1} + √(1-a_t²)·(i_t·B_t)
└── Gated merge + output projection
Once upon a time: Once upon a time, there was a little girl named Lily. She loved to play outside. She had a big, feeling very excited! She couldn't wait for a big, but she said.
The little boy was so happy to make the bird who loved A little dog: A little dog who ran to be happy. She was very excited that the park. She wanted to play with the window.
"I'm sorry, Lily. It is a voice?" She was so happy!
Ben did not give it and A girl named Lily: A girl named Lily. She was very happy he was very tall. She saw what he could not want to the forest. She says, "I'm sorry, we can have to go to the water. She was very very excited and happy.
Lily One day a boy: One day a boy named Lily liked to play with it. He said, "Don't be careful."
"We are happy, we have to go to the man that he decided to play with his friends. He was very happy that the dog had a man
import torch, json
from model import HydraModel, HydraConfig
from transformers import AutoTokenizer
config = HydraConfig(**json.load(open("config.json")))
model = HydraModel(config)
model.load_state_dict(torch.load("model.pt", map_location="cpu"))
model.eval()
tokenizer = AutoTokenizer.from_pretrained("gpt2")
prompt = "Once upon a time"
ids = torch.tensor([tokenizer.encode(prompt)])
with torch.no_grad():
out = model.generate(ids, max_new_tokens=50, temperature=0.8, top_k=40)
print(tokenizer.decode(out[0], skip_special_tokens=True))
model.pt — trained weightsconfig.json — model configurationmodel.py — full architecture source code