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 train_kaggle.py
Browse files- train_kaggle.py +15 -2
train_kaggle.py
CHANGED
|
@@ -217,12 +217,25 @@ def build_model(env, args: argparse.Namespace):
|
|
| 217 |
raise RuntimeError(f"ML stack missing: {_ML_IMPORT_ERROR}")
|
| 218 |
|
| 219 |
if _GRU_AVAILABLE and create_gru_weather_policy_kwargs is not None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
policy_kwargs = create_gru_weather_policy_kwargs(
|
| 221 |
hidden_size=args.hidden_size,
|
| 222 |
-
features_dim=
|
| 223 |
)
|
| 224 |
policy = get_equivariant_policy_class() if get_equivariant_policy_class is not None else "MultiInputPolicy"
|
| 225 |
-
logger.info(
|
|
|
|
|
|
|
|
|
|
| 226 |
else:
|
| 227 |
policy_kwargs = dict(net_arch=dict(pi=[128, 64], vf=[128, 64]))
|
| 228 |
policy = "MultiInputPolicy"
|
|
|
|
| 217 |
raise RuntimeError(f"ML stack missing: {_ML_IMPORT_ERROR}")
|
| 218 |
|
| 219 |
if _GRU_AVAILABLE and create_gru_weather_policy_kwargs is not None:
|
| 220 |
+
# GRUWeatherFeaturesExtractor's forward() reshapes per-zone features
|
| 221 |
+
# into (batch, n_zones * hidden_size * 2) -- features_dim MUST match
|
| 222 |
+
# that exactly, or SB3's MlpExtractor (built from the declared
|
| 223 |
+
# features_dim) gets a differently-shaped tensor and crashes at the
|
| 224 |
+
# first policy.forward() call. Confirmed empirically: the actual
|
| 225 |
+
# working checkpoints (final_normal/drought/humidity.zip) all have
|
| 226 |
+
# features_dim == n_zones * hidden_size * 2 (256/384/512 for
|
| 227 |
+
# n_zones=2/3/4, hidden_size=64) -- NOT hidden_size * 2, which only
|
| 228 |
+
# coincides with the correct value when n_zones == 1.
|
| 229 |
+
features_dim = args.n_zones * args.hidden_size * 2
|
| 230 |
policy_kwargs = create_gru_weather_policy_kwargs(
|
| 231 |
hidden_size=args.hidden_size,
|
| 232 |
+
features_dim=features_dim,
|
| 233 |
)
|
| 234 |
policy = get_equivariant_policy_class() if get_equivariant_policy_class is not None else "MultiInputPolicy"
|
| 235 |
+
logger.info(
|
| 236 |
+
"Using GRU policy (hidden_size=%d, n_zones=%d, features_dim=%d)",
|
| 237 |
+
args.hidden_size, args.n_zones, features_dim,
|
| 238 |
+
)
|
| 239 |
else:
|
| 240 |
policy_kwargs = dict(net_arch=dict(pi=[128, 64], vf=[128, 64]))
|
| 241 |
policy = "MultiInputPolicy"
|