vwxyzjn / cleanrl

High-quality single file implementation of Deep Reinforcement Learning algorithms with research-friendly features (PPO, DQN, C51, DDPG, TD3, SAC, PPG)
http://docs.cleanrl.dev
Other
4.91k stars 566 forks source link

run and experiment_name from docs/advanced/resume-training are undefined #399

Closed solismortis closed 9 months ago

solismortis commented 1 year ago

Problem Description

Here. Also, am I supposed to use cleanrl_utils/resume.py instead of what is in the docs?

Checklist

vwxyzjn commented 1 year ago

The resume.py is something slightly more advanced (and kind of deprecated). You should rely on the pointers in docs.

solismortis commented 1 year ago

@vwxyzjn Docs are not helpful, as run and experiment_name are not defined anywhere before the following part, including algos:

if args.track and wandb.run.resumed:
    starting_update = run.summary.get("charts/update") + 1
    global_step = starting_update * args.batch_size
    api = wandb.Api()
    run = api.run(f"{run.entity}/{run.project}/{run.id}")
    model = run.file("agent.pt")
    model.download(f"models/{experiment_name}/")
    agent.load_state_dict(torch.load(
        f"models/{experiment_name}/agent.pt", map_location=device))
    agent.eval()
    print(f"resumed at update {starting_update}")
vwxyzjn commented 1 year ago

experiment_name is now run_name.

api = wandb.Api()
run = api.run(f"{run.entity}/{run.project}/{run.id}")
solismortis commented 1 year ago

run = api.run(f"{run.entity}/{run.project}/{run.id}")

You are trying to define run with run that is not defined.

vwxyzjn commented 1 year ago

Oh i see. The run is IMG_5655

Here is the reference code https://wandb.ai/costa-huang/cleanRL/runs/21421tda/code?workspace=user-costa-huang