vwxyzjn/cleanrl

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

Closed this issue · 5 comments

Problem Description

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

Checklist

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

@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}")

experiment_name is now run_name.

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

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

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