Unverified Commit ed680898 authored by Özhan Özen's avatar Özhan Özen Committed by GitHub

Fixes `rl_games` workflow's `log_root_path` to be the absolute path (#3531)

# Description

Due to previous changes, the `rl_games` workflow's `log_root_path` is no
longer the absolute path if the pbt option is not used, causing further
issues. This PR fixes this by making it an absolute path again.

Fixes #3530 

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Screenshots

Before:

https://github.com/isaac-sim/IsaacLab/blob/3a0db9d761982dc65417e6c6d0714cec61ceadb3/scripts/reinforcement_learning/rl_games/train.py#L129-L135

After:
```
log_root_path = os.path.join("logs", "rl_games", config_name)
if "pbt" in agent_cfg and agent_cfg["pbt"]["directory"] != ".":
    log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)
else:
    log_root_path = os.path.abspath(log_root_path)
```

## Note

While this fixes the path to be absolute when pbt is not used, I am not
sure if

`log_root_path = os.path.join(agent_cfg["pbt"]["directory"],
log_root_path)`

is correct or absolute, as I do not use pbt. Should it not be something
like the following?

`log_root_path = os.path.abspath(os.path.join(log_root_path,
agent_cfg["pbt"]["directory"]))
`

I would appreciate any feedback on this.

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------
Co-authored-by: 's avatarsbtc-sipbb <sbtc@sipbb.ch>
Co-authored-by: 's avatargarylvov <67614381+garylvov@users.noreply.github.com>
Co-authored-by: 's avatargarylvov <gary.lvov@gmail.com>
parent 9f7d37f5
......@@ -138,11 +138,10 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
# specify directory for logging experiments
config_name = agent_cfg["params"]["config"]["name"]
log_root_path = os.path.join("logs", "rl_games", config_name)
if "pbt" in agent_cfg:
if agent_cfg["pbt"]["directory"] == ".":
log_root_path = os.path.abspath(log_root_path)
else:
if "pbt" in agent_cfg and agent_cfg["pbt"]["directory"] != ".":
log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)
else:
log_root_path = os.path.abspath(log_root_path)
print(f"[INFO] Logging experiment in directory: {log_root_path}")
# specify directory for logging runs
......@@ -157,6 +156,7 @@ def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agen
# dump the configuration into log-directory
dump_yaml(os.path.join(log_root_path, log_dir, "params", "env.yaml"), env_cfg)
dump_yaml(os.path.join(log_root_path, log_dir, "params", "agent.yaml"), agent_cfg)
print(f"Exact experiment name requested from command line: {os.path.join(log_root_path, log_dir)}")
# read configurations about the agent-training
rl_device = agent_cfg["params"]["config"]["device"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment