Example #1
0
def try_create_meta_curriculum(
    curriculum_folder: Optional[str], env: SubprocessEnvManager, lesson: int
) -> Optional[MetaCurriculum]:
    if curriculum_folder is None:
        return None
    else:
        meta_curriculum = MetaCurriculum(curriculum_folder, env.reset_parameters)
        # TODO: Should be able to start learning at different lesson numbers
        # for each curriculum.
        meta_curriculum.set_all_curriculums_to_lesson_num(lesson)
        for brain_name in meta_curriculum.brains_to_curriculums.keys():
            if brain_name not in env.external_brains.keys():
                raise MetaCurriculumError(
                    "One of the curricula "
                    "defined in " + curriculum_folder + " "
                    "does not have a corresponding "
                    "Brain. Check that the "
                    "curriculum file has the same "
                    "name as the Brain "
                    "whose curriculum it defines."
                )
        return meta_curriculum
Example #2
0
def try_create_meta_curriculum(curriculum_folder: Optional[str], env: BaseUnityEnvironment) -> Optional[MetaCurriculum]:
    if curriculum_folder is None:
        return None
    else:
        meta_curriculum = MetaCurriculum(curriculum_folder, env.reset_parameters)
        if meta_curriculum:
            for brain_name in meta_curriculum.brains_to_curriculums.keys():
                if brain_name not in env.external_brains.keys():
                    raise MetaCurriculumError('One of the curricula '
                                              'defined in ' +
                                              curriculum_folder + ' '
                                              'does not have a corresponding '
                                              'Brain. Check that the '
                                              'curriculum file has the same '
                                              'name as the Brain '
                                              'whose curriculum it defines.')
        return meta_curriculum
Example #3
0
def try_create_meta_curriculum(
        curriculum_folder: Optional[str],
        env: SubprocessEnvManager) -> Optional[MetaCurriculum]:
    if curriculum_folder is None:
        return None
    else:
        meta_curriculum = MetaCurriculum(curriculum_folder,
                                         env.reset_parameters)
        if meta_curriculum:
            for brain_name in meta_curriculum.brains_to_curriculums.keys():
                if brain_name not in env.external_brains.keys():
                    raise MetaCurriculumError("One of the curricula "
                                              "defined in " +
                                              curriculum_folder + " "
                                              "does not have a corresponding "
                                              "Brain. Check that the "
                                              "curriculum file has the same "
                                              "name as the Brain "
                                              "whose curriculum it defines.")
        return meta_curriculum