Metadata-Version: 2.5
Name: netris-rl
Version: 0.1.0
Summary: Behavior cloning, DAgger and anchored PPO training for the netris environment
Project-URL: Homepage, https://github.com/javi-aranda/netris
Author: Javier Aranda
License: MIT License
        
        Copyright (c) 2026 Javier Aranda
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: behavior-cloning,gameboy,ppo,reinforcement-learning,tetris
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: netris<0.2,>=0.1
Requires-Dist: stable-baselines3>=2.0
Requires-Dist: tensorboard>=2.0
Requires-Dist: torch>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# netris-rl

Training utilities for the [netris](../netris) Game Boy Tetris environment:
behavior cloning from a heuristic teacher, DAgger rounds and PPO fine-tuning
with a KL anchor.

## Install

```bash
pip install netris-rl
```

## CLIs

```bash
# collect teacher demonstrations (optionally DAgger with --policy-model)
netris-collect --rom /path/to/tetris.gb --steps 30000 --workers 2

# behavior cloning (optionally warm-started with --init-model)
netris-bc --demos "logs/demos/demos_*.npz" --epochs 30 --output logs/bc/model

# PPO fine-tuning, optionally anchored to a frozen reference policy
netris-train --rom /path/to/tetris.gb --resume --no-obs-norm \
    --anchor-model logs/bc/model.zip --total-steps 500000

# evaluation
netris-eval --model logs/best_model/best_model.zip --episodes 20
```

## Pipeline used to reach a line-clearing agent

1. `netris-collect` with the analytic Dellacherie teacher.
2. `netris-bc` (behavior cloning).
3. `netris-collect --policy-model` (DAgger), then `netris-bc --init-model`.
4. `netris-train --resume --anchor-model <bc model>` (anchored PPO).

## License

MIT.
