Downloads · 30 days
0
Hana-ame/maze-transformer
maze-transformer is a reinforcement learning model from Hana-ame. Use it for the reinforcement learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
[](https://colab.research.google.com/github/Hana-ame/agent/blob/hf-submodule/ColabRunMazeTransformer.ipynb) [](LICENSE) [](https://pytorch.org/)
Downloads · 30 days
0
Access
Public
Updated Oct 6, 2026
Repo size
2.6 MB
Likes
0
Public
Click a slice to open those files.
.py187 KB · 77%
From the Hugging Face model README
MazeGPT investigates how compact autoregressive Transformers can develop reactive spatial navigation and obstacle avoidance in partially observable 2D maze environments (POMDP) under pure reinforcement learning (Zero Pretraining).
U, D, L, R (where . denotes an open path, and # denotes a wall; out-of-bounds cells are treated as walls).U, D, L, R with step delimiters.G; intermediate rewards are 0. No shortest-path BFS/A supervision is provided during training*.Train and evaluate pure RL agents using free Colab GPUs/CPUs:
Colab_Run_Maze_Transformer.ipynb..ipynb file.# 1. Clone repository
git clone https://huggingface.co/Hana-ame/maze-transformer
cd maze-transformer
# 2. Install dependencies (Python >= 3.8, PyTorch >= 2.0)
pip install torch openpyxl huggingface_hub matplotlib pandas
pip install -e .
# Test dynamic agent navigation on a randomized 5x7 maze
./use_model.sh --checkpoint checkpoints/l2_d64_maze_forced_obs_rl_final.pt
maze_config.jsonmaze_config.json{
"layers": 2,
"d": 64,
"heads": 4,
"steps": 120,
"batch_size": 6,
"lr": 3e-4,
"min_size": 5,
"max_size": 9,
"single": true,
"datasource": {
"type": "random_perfect_maze",
"observation": "forced_obs_4cell",
"reward": "sparse_goal_reach"
}
}
# Pure RL (GRPO) training
python -m maze_transformer.train --config maze_config.json
# 50-step smoke verification
python -m maze_transformer.train --quick
Evaluate goal reaching rates and collision counts across random maze topologies:
python -m maze_transformer.evaluate --checkpoint checkpoints/l2_d64_maze_forced_obs_rl_final.pt --sizes 5x5,5x7,6x6,6x9 --n_trials 24
Quantize linear weights via PyTorch dynamic INT8 to assess policy stability:
python -m maze_transformer.quantize --checkpoint checkpoints/l2_d64_maze_forced_obs_rl_final.pt
| Checkpoint Identifier | Architecture | Protocol | Notes & Performance |
|---|---|---|---|
l2_d64_maze_forced_obs_rl_final.pt | 2L · 64d · 4 heads | Pure RL (GRPO 120 steps) | Primary model (5x7 maze reach rate 83.3%) |
l2_d64_maze_rnn_rl_ref.pt | 1L · 128d · GRU-RNN | Pure RL (120 steps) | Recurrent baseline control model |
l2_d64_maze_sft_ref.pt | 2L · 64d · Transformer | SFT (BFS Shortest Path) | Supervised navigation upper bound baseline |
All 13 maze navigation experiments (GRPO vs. REINFORCE vs. RNN across 60/120/300 steps, context compression, and INT8 quantization) are recorded in:
👉 EXPERIMENTS_ALL.xlsx
This repository is distributed under the MIT License.