Downloads · 30 days
12
31% of all-time downloads
av-codes/miras-shakespeare
miras-shakespeare is a machine learning model from av-codes. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A character-level language model trained on Shakespeare using the MIRAS (Memory-Integrated Recurrent Attention System) architecture.
Downloads · 30 days
12
31% of all-time downloads
All-time downloads
39
Public
Repo size
45.2 MB
Likes
0
Public
Click a slice to open those files.
.pt45.2 MB · 100%
From the Hugging Face model README
A character-level language model trained on Shakespeare using the MIRAS (Memory-Integrated Recurrent Attention System) architecture.
pip install torch huggingface_hub
from huggingface_hub import hf_hub_download
import torch
# Download files
for f in ["modeling_miras.py", "model.pt", "config.json"]:
hf_hub_download(repo_id="av-codes/miras-shakespeare", filename=f, local_dir="./miras")
# Import and load
import sys
sys.path.insert(0, "./miras")
from modeling_miras import load_miras_model
model, encode, decode, config = load_miras_model("./miras")
model.eval()
# Generate text
context = torch.zeros((1, 1), dtype=torch.long)
output = model.generate(context, max_new_tokens=200, temperature=0.8)
print(decode(output[0].tolist()))
from modeling_miras import load_miras_model
# Load directly from Hub
model, encode, decode, config = load_miras_model("av-codes/miras-shakespeare")
# Generate
import torch
context = torch.zeros((1, 1), dtype=torch.long)
generated = model.generate(context, max_new_tokens=100)
print(decode(generated[0].tolist()))
model.pt - Model weights and architecture configconfig.json - Full configuration including vocabularymodeling_miras.py - Complete model architecture codeTrained for 5000 iterations on the TinyShakespeare dataset.
MIRAS uses a novel memory-based attention mechanism with configurable:
linear (matrix memory) or deep (MLP memory)l2, lp, or huber loss functionsl2, kl, or elastic weight update rules