浏览代码

better checking of the format of the curriculum file

/develop-generalizationTraining-TrainerController
vincentpierre 7 年前
当前提交
250eb8e1
共有 2 个文件被更改,包括 28 次插入22 次删除
  1. 11
      python/unityagents/curriculum.py
  2. 39
      python/unityagents/environment.py

11
python/unityagents/curriculum.py


except:
raise UnityEnvironmentException(
"The file {0} could not be found.".format(location))
parameters = self.data["parameters"]
self.measure_type = self.data["measure"]
self.smoothing_value = 0
for key in ['parameters', 'measure', 'thresholds',
'min_lesson_length', 'signal_smoothing']:
if key not in self.data:
raise UnityEnvironmentException("{0} does not contain a "
"{1} field.".format(location, key))
parameters = self.data['parameters']
self.measure_type = self.data['measure']
self.smoothing_value = 0
for key in parameters:
if key not in default_reset_parameters:
raise UnityEnvironmentException(

39
python/unityagents/environment.py


"The Unity environment took too long to respond. Make sure {} does not need user interaction to launch "
"and that the Academy and the external Brain(s) are attached to objects in the Scene.".format(
str(file_name)))
self._data = {}
self._global_done = None
self._academy_name = p["AcademyName"]
self._brains = {}
self._brain_names = p["brainNames"]
self._external_brain_names = p["externalBrainNames"]
self._external_brain_names = [] if self._external_brain_names is None else self._external_brain_names
self._num_brains = len(self._brain_names)
self._num_external_brains = len(self._external_brain_names)
self._resetParameters = p["resetParameters"]
self._curriculum = Curriculum(curriculum, self._resetParameters)
for i in range(self._num_brains):
self._brains[self._brain_names[i]] = BrainParameters(self._brain_names[i], p["brainParameters"][i])
self._loaded = True
logger.info("\n'{}' started successfully!".format(self._academy_name))
if (self._num_external_brains == 0):
logger.warning(" No External Brains found in the Unity Environment. "
"You will not be able to pass actions to your agent(s).")
self._data = {}
self._global_done = None
self._academy_name = p["AcademyName"]
self._brains = {}
self._brain_names = p["brainNames"]
self._external_brain_names = p["externalBrainNames"]
self._external_brain_names = [] if self._external_brain_names is None else self._external_brain_names
self._num_brains = len(self._brain_names)
self._num_external_brains = len(self._external_brain_names)
self._resetParameters = p["resetParameters"]
self._curriculum = Curriculum(curriculum, self._resetParameters)
for i in range(self._num_brains):
self._brains[self._brain_names[i]] = BrainParameters(self._brain_names[i], p["brainParameters"][i])
self._loaded = True
logger.info("\n'{}' started successfully!".format(self._academy_name))
if (self._num_external_brains == 0):
logger.warning(" No External Brains found in the Unity Environment. "
"You will not be able to pass actions to your agent(s).")
@property
def brains(self):

正在加载...
取消
保存