-
Notifications
You must be signed in to change notification settings - Fork 144
[ENVIRONMENT] Wildfire Environment to simulate Wildfires for OpenEnv (FastAPI, RL-compatible) #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Updated README with sample rendering code for wildfree simulation.
Added sections on wildfire simulation motivation, research goals, and citations to the README.
This commit addresses all the review comments from PR meta-pytorch#108: 1. Remove .ipynb_checkpoints directories from version control - Deleted all checkpoint files that were accidentally committed 2. Fix hardcoded file paths in README - Removed hardcoded path: sys.path.append("/workspace/OpenEnv/src") - Changed port from 8020 to 8000 for consistency - Removed unnecessary import of WildfireEnvironment from example 3. Standardize environment variable naming - Changed WILDFIRE_W to WILDFIRE_WIDTH in server/app.py - Changed WILDFIRE_H to WILDFIRE_HEIGHT in server/app.py - Now consistent with documentation and other env vars 4. Fix action case consistency - Changed "WAIT" to "wait" in README example - Ensures consistency with lowercase action names 5. Add note about Jupyter-specific dependencies - Added note in README explaining IPython requirements - References new standalone example file 6. Add burn_timers to WildfireState dataclass - Added burn_timers field to models.py for type safety - Prevents runtime attribute assignment outside dataclass 7. Create examples/wildfire.py demonstration file - New standalone Python example without Jupyter dependencies - Demonstrates basic firefighting strategy - Includes visualization using render_grid function 8. Code cleanup - Fixed formatting in models.py (moved misplaced comment) - Removed unused imports (List, replace) from wildfire_environment.py - Improved import organization and PEP 8 compliance - Fixed typo: "wildfree" to "wildfire" in README All changes maintain backward compatibility while improving code quality and usability.
Address final Copilot AI review comments: 1. Add blank line before render_grid function (PEP 8) - Added two blank lines between class and module-level function 2. Fix excessive whitespace in client.py - Removed extra spaces after "burned=" in metadata string 3. Fix inconsistent indentation in wildfire_environment.py - Corrected state property indentation to use 4-space standard - Fixed comment alignment - Fixed docstring and return statement indentation All code now follows PEP 8 style guidelines.
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Wildfire Environment to the OpenEnv framework, enabling reinforcement learning research on autonomous wildfire containment strategies. The environment simulates weather-aware fire spread dynamics where agents must strategically use water and firebreaks to contain fires under varying wind and humidity conditions.
Key changes:
- Implements a grid-based wildfire simulation with 8-directional spread, wind effects, and humidity factors
- Adds server-side environment (
WildfireEnvironment) with configurable parameters and reward shaping - Provides HTTP client (
WildfireEnv) with visualization utilities for monitoring fire dynamics - Integrates with CI/CD pipelines for automated HuggingFace deployment
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/envs/wildfire_env/server/wildfire_environment.py | Core simulation engine implementing fire spread, agent actions, and reward computation |
| src/envs/wildfire_env/models.py | Data models for actions, observations, and state |
| src/envs/wildfire_env/client.py | HTTP client and grid rendering utilities |
| src/envs/wildfire_env/server/app.py | FastAPI application setup with environment variable configuration |
| src/envs/wildfire_env/server/Dockerfile | Container configuration for deploying the environment |
| src/envs/wildfire_env/server/build_docker.sh | Docker build automation script |
| src/envs/wildfire_env/README.md | Comprehensive documentation with usage examples and references |
| examples/wildfire.py | Example script demonstrating environment usage and agent strategies |
| .github/workflows/deploy-hf-env.yml | CI/CD workflow updates for wildfire environment |
| scripts/prepare_hf_deployment.sh | Deployment script updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
2 similar comments
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
This commit addresses critical runtime errors and adds comprehensive documentation for the wildfire environment. Bug Fixes: - Fix TypeError in in_bounds() and idx() functions by adding defensive type conversion for all parameters (x, y, w, h) to ensure integers - Fix IndexError in _apply_water(), _apply_break(), _spread_fire(), and reset() by adding bounds checks before accessing grid arrays - Ensure self.w and self.h are explicitly cast to int during initialization - Add safety checks in _spread_fire() for ignite_flags array bounds - Use local w/h variables after type conversion to maintain consistency Infrastructure: - Add run_wildfire_docker.sh convenience script with automatic base image building and log streaming - Script builds openenv-base:latest if missing and rebuilds wildfire image to ensure latest code is included Documentation: - Complete rewrite of wildfire_env/README.md with comprehensive guide - Detailed action documentation with rewards and use cases - Grid format explanation with code examples - Fire spread mechanics and wind effects - Complete API reference with examples - Four practical code examples (containment, firebreak, visualization, RL) - Troubleshooting guide for common issues - Configuration options and environment variables - Web interface usage guide - Performance considerations All changes are backward compatible and improve environment stability and usability for both RL agents and developers.
|
✅ Deployment succeeded for
Nice work! Wait for a code review and we're ready to go. You can iterate locally or validate fixes by running |
- Fix CMD format: Changed from problematic sh -lc exec form to shell form to allow PORT variable expansion required by Hugging Face Spaces - Update dependency: Changed openenv-core>=0.1.0 to openenv-core[core]>=0.2.0 to match other standalone environments (snake_env, coding_env) - Add proxy headers for HF Spaces compatibility - Resolves ModuleNotFoundError when deploying to Hugging Face Spaces
- Fix Windows console encoding to support Unicode characters in CLI - Add UTF-8 encoding for file operations in push command - Create http_env_client.py module with HTTPEnvClient class - Add compatibility shim for wildfire_env to work with older openenv-core packages - Update client.py to use compatibility shim as fallback
|
@burtenshaw hey i have made the necessary changes, please take a look when you are free and let me know if anything else needs to be done. The environment is up and running at https://huggingface.co/spaces/shankerram3/wildfire_env and updated docs/environment.md |
Fixed all the comments in PR #108