ISN Shakespeare: Character-level Language Model
This repository contains the weights and configuration for a Shakespeare-style language model built using the Inertial State Network (ISN) architecture.
π Highlights
- Architecture: Inertial State Network (ISN).
- Parameters: 363,329 (Equivalent to nanoGPT baseline).
- Inference Efficiency: Constant $O(1)$ VRAM and $O(1)$ per-step time scaling.
- Performance: 2.48 PPL on TinyShakespeare (Official).
- Train seq_lenght: 128
π» Technical Usage (Inference)
To run inference locally, you need the GFN Framework installed.
1. Install GFN Framework
pip install gfn
2. Clone this repository
git lfs install
git clone https://huggingface.co/DepthMuun/gfn-isn-shakespeare-char
cd gfn-isn-shakespeare-char
3. Run Inference Script
The repository includes an inference.py script for interactive generation:
python inference.py
Python API Example (Manual Assembly)
As shown in the audited inference.py, the official way to load ISN models is:
import torch
import json
from gfn import isn
# 1. Load Config
with open("config.json", "r") as f:
config = json.load(f)
# 2. Instantiate Model (Manual Schema)
model = isn.create(
vocab_size=65, # Unique characters in tinyshakespeare.txt
d_model=config['model']['d_model'],
d_embedding=config['model']['d_embedding'],
d_properties=config['model']['d_properties'],
scanner_cls=isn.GFNScanner,
world_cls=isn.GFNWorld,
emitter_cls=isn.GFNEmitter
).to("cpu")
# 3. Load State Dict
checkpoint = torch.load("best_model.pt", map_location="cpu")
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# 4. Generate Text
# Use model.generate() or the provided inference.py CLI
π Citation
If you use this work, please cite:
@article{sturtz2026geometry,
title={Geometric Flow Networks: A Physics-Informed Paradigm for Sequential Intelligence},
author={StΓΌrtz, JoaquΓn},
journal={Zenodo Preprints},
year={2026},
doi={10.5281/zenodo.19141133},
url={https://doi.org/10.5281/zenodo.19141133}
}
π Resources
- Interactive Demo: Hugging Face Space
- Framework Source: GitHub: DepthMuun/gfn
- Official Paper: Zenodo
- Downloads last month
- 245
Space using DepthMuun/gfn-isn-shakespeare-char 1
Evaluation results
- Perplexity on tinyshakespeareself-reported2.480