--- title: Compiler Tetris — Toy-IR RL Demo emoji: 🧩 colorFrom: gray colorTo: indigo sdk: docker sdk_version: 5.12.0 app_file: app.py pinned: false license: mit --- # Compiler Tetris (Toy-IR) — Hugging Face Space Interactive **CPU** demo for the Meta / OpenEnv-style **compiler phase-ordering** project: - **Deliverable 2 — state translation:** JSON Toy-IR → compact pseudo-assembly for the LLM. - **Deliverable 2 — format enforcement:** resilient extraction of a JSON **pass array** from noisy model text. - **CompilerOptimizationEnv** (mock Role 1 engine + mock passes): step through passes and inspect rewards. Full **GRPO / Unsloth** training is not run here (heavy GPU + long installs). Use your notebooks on Colab or a GPU Space for training. ## Source notebooks (parent repo) - `compiler_optimization_grpo.ipynb` - `role2_deliverable3_training_loop (2) (1).ipynb` - `compiler_tetris (1).ipynb` - `metahack1 (1).ipynb` ## Deploy this folder as a new Space 1. Create a new Space on Hugging Face (SDK: **Gradio**). 2. Upload the contents of this `hf_space/` directory to the Space repository root (`app.py`, `requirements.txt`, `README.md`). 3. Optional: add `Dockerfile` only if you switch the Space to **Docker** (see below). ## Optional: Docker SDK instead of Gradio SDK If you want the Space to build from `Dockerfile`, change the YAML header to: ```yaml sdk: docker ``` and remove Gradio-specific keys (`sdk_version`, `app_file`). The container runs `python app.py`, which listens on the `PORT` environment variable provided by Spaces. ## Local run ```bash cd hf_space pip install -r requirements.txt python app.py ``` Then open `http://127.0.0.1:7860`.