| 23 | return all_args |
| 24 | |
| 25 | def test_matplot(args): |
| 26 | |
| 27 | all_args = parse(args) |
| 28 | |
| 29 | random.seed(all_args.seed) |
| 30 | |
| 31 | run_dir = Path("../results") / all_args.project_name / all_args.experiment_name |
| 32 | if not run_dir.exists(): |
| 33 | os.makedirs(str(run_dir)) |
| 34 | |
| 35 | wandb.init(config=all_args, |
| 36 | project=all_args.project_name, |
| 37 | entity=all_args.team_name, |
| 38 | notes=socket.gethostname(), |
| 39 | name=all_args.experiment_name+"_"+str(all_args.seed), |
| 40 | group=all_args.scenario_name, |
| 41 | dir=str(run_dir), |
| 42 | job_type="training", |
| 43 | reinit=True) |
| 44 | |
| 45 | x = np.arange(1, 11) |
| 46 | for step in range(4): |
| 47 | frames = [] |
| 48 | y = step * x + step |
| 49 | plt.title("Matplotlib Demo") |
| 50 | plt.xlabel("x axis caption") |
| 51 | plt.ylabel("y axis caption") |
| 52 | plt.plot(x, y) |
| 53 | wandb.log({"plt":wandb.Plotly(plt.gcf())},step=step) |
| 54 | |
| 55 | if __name__ == '__main__': |
| 56 | test_matplot(sys.argv[1:]) |