Reinforcement Learning
stable-baselines3
deep-reinforcement-learning
agricultural-ai
weather-modelling
curriculum-learning
edge-ai
Instructions to use DHDRL/monsoon-rl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- stable-baselines3
How to use DHDRL/monsoon-rl with stable-baselines3:
from huggingface_sb3 import load_from_hub checkpoint = load_from_hub( repo_id="DHDRL/monsoon-rl", filename="{MODEL FILENAME}.zip", ) - Notebooks
- Google Colab
- Kaggle
Update weather_forecast_env.py
Browse files- weather_forecast_env.py +16 -0
weather_forecast_env.py
CHANGED
|
@@ -380,6 +380,7 @@ class WeatherForecastEnv(gym.Env):
|
|
| 380 |
self._cum_reward: float = 0.0
|
| 381 |
self._episode_count: int = 0
|
| 382 |
self._episode_seed: int = 0
|
|
|
|
| 383 |
|
| 384 |
self._real_index = None
|
| 385 |
pkl_path = getattr(self.config, "real_data_pkl_path", None)
|
|
@@ -468,6 +469,17 @@ class WeatherForecastEnv(gym.Env):
|
|
| 468 |
|
| 469 |
self._zone_ids = list(self._context.zone_ids)
|
| 470 |
n_active = len(self._zone_ids)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
|
| 472 |
if n_active > self.max_zones:
|
| 473 |
raise ValueError(
|
|
@@ -853,6 +865,10 @@ class WeatherForecastEnv(gym.Env):
|
|
| 853 |
"mean_belief": float(np.mean(active_belief)) if n_active else 0.0,
|
| 854 |
"mean_uncertainty": float(np.mean(active_unc)) if n_active else 0.0,
|
| 855 |
"n_visited": int(self._visited[:n_active].sum()) if n_active else 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 856 |
}
|
| 857 |
|
| 858 |
def render(self, mode: Optional[str] = None) -> None:
|
|
|
|
| 380 |
self._cum_reward: float = 0.0
|
| 381 |
self._episode_count: int = 0
|
| 382 |
self._episode_seed: int = 0
|
| 383 |
+
self._context_source: str = "synthetic"
|
| 384 |
|
| 385 |
self._real_index = None
|
| 386 |
pkl_path = getattr(self.config, "real_data_pkl_path", None)
|
|
|
|
| 469 |
|
| 470 |
self._zone_ids = list(self._context.zone_ids)
|
| 471 |
n_active = len(self._zone_ids)
|
| 472 |
+
self._context_source = context_source # stamped onto every step's
|
| 473 |
+
# info via _get_info(), not
|
| 474 |
+
# just reset's -- SB3's
|
| 475 |
+
# DummyVecEnv stores
|
| 476 |
+
# auto-reset info separately
|
| 477 |
+
# from what step() returns,
|
| 478 |
+
# so anything only set in
|
| 479 |
+
# reset()'s info dict is
|
| 480 |
+
# invisible to a callback's
|
| 481 |
+
# self.locals["infos"].
|
| 482 |
+
# Confirmed empirically.
|
| 483 |
|
| 484 |
if n_active > self.max_zones:
|
| 485 |
raise ValueError(
|
|
|
|
| 865 |
"mean_belief": float(np.mean(active_belief)) if n_active else 0.0,
|
| 866 |
"mean_uncertainty": float(np.mean(active_unc)) if n_active else 0.0,
|
| 867 |
"n_visited": int(self._visited[:n_active].sum()) if n_active else 0,
|
| 868 |
+
# Stamped on EVERY step's info via this method, not just reset's --
|
| 869 |
+
# see the comment in reset() where self._context_source is set for
|
| 870 |
+
# why that distinction matters under SB3's VecEnv autoreset.
|
| 871 |
+
"context_source": self._context_source,
|
| 872 |
}
|
| 873 |
|
| 874 |
def render(self, mode: Optional[str] = None) -> None:
|