Skip to content

More Flexible WandB Interface #80

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions rsl_rl/utils/wandb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import annotations

import os
import warnings
from dataclasses import asdict
from torch.utils.tensorboard import SummaryWriter

Expand All @@ -25,17 +26,19 @@ def __init__(self, log_dir: str, flush_secs: int, cfg):
run_name = os.path.split(log_dir)[-1]

try:
project = cfg["wandb_project"]
project = cfg["wandb_kwargs"]["project"]
except KeyError:
raise KeyError("Please specify wandb_project in the runner config, e.g. legged_gym.")

try:
entity = os.environ["WANDB_USERNAME"]
entity = cfg["wandb_kwargs"]["entity"]
except KeyError:
entity = None
warnings.warn("No entity specified for wandb logging. Defaulting to None.")
if "name" not in cfg["wandb_kwargs"]:
cfg["wandb_kwargs"]["name"] = run_name
warnings.warn(f"No name specified for wandb logging. Defaulting to {run_name}.")

# Initialize wandb
wandb.init(project=project, entity=entity, name=run_name)
wandb.init(**cfg["wandb_kwargs"])

# Add log directory to wandb
wandb.config.update({"log_dir": log_dir})
Expand Down