Replies: 2 comments
-
|
Hi @merhovon, thank you for your kind words. Line 359 in 33b6366 That is the main entry point: i think that with some hydra machinery, something similar to what you're asking can be achieved. Everything runs through hydra, so configs must come from there. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @belerico, Thanks again for pointing me to the from hydra import initialize, compose
from omegaconf import DictConfig
from sheeprl.cli import run
def train_dreamerv3_gym():
with initialize(config_path="conf"):
cfg: DictConfig = compose(
config_name="config",
overrides=[
"algo=dreamerv3", # world-model-based training
"env=gym", # use gym/Gymnasium backend
"env_id=CartPole-v1", # your chosen gym env
"runner.total_steps=25000", # number of env interactions
"runner.device=cuda" # or "cpu"
]
)
run(cfg)
if __name__ == "__main__":
train_dreamerv3_gym()A few quick checks:
Thanks for confirming, so I can integrate this directly into my Python training script! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi SheepRL team,
First of all, thank you for creating such a clean, Lightning-Fabric–powered RL library! I’ve been using it alongside Gymnasium and really appreciate having DreamerV3 natively included.
In Stable Baselines3 I’m used to a very straightforward Python workflow:
I simply call model.learn(), it handles the training loop on my vectorized Gym env, and I can pull in callbacks, tensorboard logging, etc.
🐑 My question / request
I’d like to invoke SheepRL entirely from Python—without having to drop into the sheeprl CLI tool—for both PPO and DreamerV3. Ideally I’d write something like:
from sheeprl import Experiment
…and for DreamerV3 something analogous:
However, I haven’t found a minimal, working example in the docs under howto/ that shows me the exact Python-API calls (imports, parameters, callbacks, saving checkpoints, etc.) for these setups.
Could you please:
Confirm whether SheepRL’s Python API supports this kind of direct “single-call” experiment launch without going through Bash?
Provide minimal code snippets for both a PPO experiment and a DreamerV3 experiment, equivalent to SB3’s learn() interface, including how to:
Define the environment in Python (Gymnasium)
Configure number of environments, timesteps/steps, device
Attach tensorboard logging or callbacks
Save and load policies/checkpoints
Thank you in advance for your help and for maintaining SheepRL! 😊
Environment:
SheepRL v0.5.7
Python 3.10
Beta Was this translation helpful? Give feedback.
All reactions