Downloads · 30 days
0
Elriggs/simplestories-bilinear-attn
simplestories-bilinear-attn is a machine learning model from Elriggs. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Collection of ToyTransformer models with CausalBilinearSelfAttention trained on SimpleStories dataset.
Downloads · 30 days
0
Access
Public
Updated Dec 5, 2025
Repo size
21.5 MB
Likes
0
Public
Click a slice to open those files.
.bin21.5 MB · 100%
From the Hugging Face model README
Collection of ToyTransformer models with CausalBilinearSelfAttention trained on SimpleStories dataset.
| Model | Layers | Type | Final Val Loss |
|---|---|---|---|
attention_only_1L_bilinear_attn | 1 | Attention only | ~2.91 |
attention_only_2L_bilinear_attn | 2 | Attention only | ~2.87 |
These models use CausalBilinearSelfAttention which computes squared attention patterns:
(Q1, K1) and (Q2, K2)(Q1 @ K1.T) * (Q2 @ K2.T) (element-wise product)from huggingface_hub import hf_hub_download
import torch
import json
# Download a model
model_name = "attention_only_1L_bilinear_attn"
config_path = hf_hub_download(repo_id="Elriggs/simplestories-bilinear-attn", filename=f"{model_name}/config.json")
weights_path = hf_hub_download(repo_id="Elriggs/simplestories-bilinear-attn", filename=f"{model_name}/pytorch_model.bin")
# Load config
with open(config_path) as f:
config_dict = json.load(f)
# Use with ToyTransformer from this repo
from utils import ToyTransformer, ModelConfig
for key in ['num_batches', 'final_train_loss', 'final_val_loss', 'learning_rate', 'batch_size']:
config_dict.pop(key, None)
config = ModelConfig(**config_dict)
model = ToyTransformer(config)
model.load_state_dict(torch.load(weights_path, map_location='cpu'), strict=False)
Source code: toy_models_of_tensor_networks