Skip to content

Consistent string style in trainer_controller.py #1177

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

Merged
merged 2 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions docs/Installation-Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,12 @@ Nvidia Developer Program.
</p>

Once you've signed up, go back to the cuDNN
[downloads page](https://developer.nvidia.com/cudnn). You may or may not be asked to fill
out a short survey. When you get to the list cuDNN releases, __make sure you are
downloading the right version for the CUDA toolkit you installed in Step 1.__
In this guide, we are using version 7.0.5 for CUDA toolkit version 9.0 ([direct
link](https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/cudnn-9.0-windows10-x64-v7)).
[downloads page](https://developer.nvidia.com/cudnn).
You may or may not be asked to fill out a short survey. When you get to the list
cuDNN releases, __make sure you are downloading the right version for the CUDA
toolkit you installed in Step 1.__ In this guide, we are using version 7.0.5 for
CUDA toolkit version 9.0
([direct link](https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/cudnn-9.0-windows10-x64-v7)).

After you have downloaded the cuDNN files, you will need to extract the files
into the CUDA toolkit directory. In the cuDNN zip file, there are three folders
Expand Down
47 changes: 24 additions & 23 deletions ml-agents/mlagents/trainers/trainer_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, env_path, run_id, save_freq, curriculum_folder,
self.summaries_dir = '/{docker_target_name}/summaries'.format(
docker_target_name=docker_target_name)

self.logger = logging.getLogger("mlagents.envs")
self.logger = logging.getLogger('mlagents.envs')
self.run_id = run_id
self.save_freq = save_freq
self.lesson = lesson
Expand Down Expand Up @@ -117,11 +117,11 @@ def __init__(self, env_path, run_id, save_freq, curriculum_folder,
raise MetaCurriculumError('One of the curriculums '
'defined in ' +
self.curriculum_folder + ' '
'does not have a corresponding '
'Brain. Check that the '
'curriculum file has the same '
'name as the Brain '
'whose curriculum it defines.')
'does not have a corresponding '
'Brain. Check that the '
'curriculum file has the same '
'name as the Brain '
'whose curriculum it defines.')

def _get_measure_vals(self):
if self.meta_curriculum:
Expand Down Expand Up @@ -149,22 +149,23 @@ def _process_graph(self):
if scope == '/':
scope = ''
scopes += [scope]
if self.trainers[brain_name].parameters["trainer"] \
== "imitation":
nodes += [scope + x for x in ["action"]]
if self.trainers[brain_name].parameters['trainer'] \
== 'imitation':
nodes += [scope + x for x in ['action']]
else:
nodes += [scope + x for x in ["action", "value_estimate",
"action_probs", "value_estimate"]]
if self.trainers[brain_name].parameters["use_recurrent"]:
nodes += [scope + x for x in ["recurrent_out",
"memory_size"]]
nodes += [scope + x for x in ['action', 'value_estimate',
'action_probs',
'value_estimate']]
if self.trainers[brain_name].parameters['use_recurrent']:
nodes += [scope + x for x in ['recurrent_out',
'memory_size']]
if len(scopes) > 1:
self.logger.info("List of available scopes :")
self.logger.info('List of available scopes :')
for scope in scopes:
self.logger.info("\t" + scope)
self.logger.info("List of nodes to export :")
self.logger.info('\t' + scope)
self.logger.info('List of nodes to export :')
for n in nodes:
self.logger.info("\t" + n)
self.logger.info('\t' + n)
return nodes

def _save_model(self, sess, saver, steps=0):
Expand All @@ -178,7 +179,7 @@ def _save_model(self, sess, saver, steps=0):
saver.save(sess, last_checkpoint)
tf.train.write_graph(sess.graph_def, self.model_path,
'raw_graph_def.pb', as_text=False)
self.logger.info("Saved Model")
self.logger.info('Saved Model')

def _export_graph(self):
"""
Expand All @@ -191,11 +192,11 @@ def _export_graph(self):
input_binary=True,
input_checkpoint=ckpt.model_checkpoint_path,
output_node_names=target_nodes,
output_graph=(self.model_path + '/' + self.env_name + "_"
output_graph=(self.model_path + '/' + self.env_name + '_'
+ self.run_id + '.bytes'),
clear_devices=True, initializer_nodes="", input_saver="",
restore_op_name="save/restore_all",
filename_tensor_name="save/Const:0")
clear_devices=True, initializer_nodes='', input_saver='',
restore_op_name='save/restore_all',
filename_tensor_name='save/Const:0')

def _initialize_trainers(self, trainer_config, sess):
trainer_parameters_dict = {}
Expand Down