awslabs / sagemaker-battlesnake-ai

Starter pack to build an AI for Battlesnake with Amazon Sagemaker more content on wiki:
https://github.com/awslabs/sagemaker-battlesnake-ai/wiki
Apache License 2.0
89 stars 53 forks source link

MXBoard Integration in the Example is Broken #17

Closed kshahzada closed 4 years ago

kshahzada commented 4 years ago

Summary of Bug When you try to use the Writer param in examples/train.py so you can view the training process with MXBoard/Tensorboard, the program crashes.

Steps to reproduce:

  1. Run: python3 train.py --should_render --writer --run_name test_1 --render_steps 100
  2. Notice ->

    Traceback (most recent call last): File "train.py", line 193, in run(seed, args) File "train.py", line 42, in run writer = SummaryWriter("logs/{}-seed{}".format(run_name, seed), verbose=False) NameError: name 'run_name' is not defined and/or Traceback (most recent call last): File "train.py", line 193, in run(seed, args) File "train.py", line 91, in run args.writer, args.print_progress) File "/Users/Kshahzada/Documents/GitHub/sagemaker-battlesnake-ai/TrainingEnvironment/examples/dqn_run.py", line 85, in trainer writer.addscalar("rewards{}".format(i), score[i], i_episode) AttributeError: 'bool' object has no attribute 'add_scalar'

Expected Output Should start creating logs for Tensorboard to use.

Actual Output Crashes.

kshahzada commented 4 years ago

^^^ I've proposed a functioning fix

jonomon commented 4 years ago

Merged with https://github.com/awslabs/sagemaker-battlesnake-ai/pull/18