浏览代码

[bug-fix] Fix issue where curriculum was advancing too early (#4107)

/release_3_branch
GitHub 5 年前
当前提交
8fb66c2d
共有 2 个文件被更改,包括 24 次插入1 次删除
  1. 2
      ml-agents/mlagents/trainers/settings.py
  2. 23
      ml-agents/mlagents/trainers/tests/test_meta_curriculum.py

2
ml-agents/mlagents/trainers/settings.py


REWARD: str = "reward"
measure: str = attr.ib(default=MeasureType.REWARD)
thresholds: List[int] = attr.ib(factory=list)
thresholds: List[float] = attr.ib(factory=list)
min_lesson_length: int = 0
signal_smoothing: bool = True
parameters: Dict[str, List[float]] = attr.ib(kw_only=True)

23
ml-agents/mlagents/trainers/tests/test_meta_curriculum.py


import pytest
from unittest.mock import patch, Mock, call
import yaml
import cattr
from mlagents.trainers.meta_curriculum import MetaCurriculum

@pytest.fixture
def reward_buff_sizes():
return {"Brain1": 7, "Brain2": 8}
def test_convert_from_dict():
config = yaml.safe_load(
"""
measure: progress
thresholds: [0.1, 0.3, 0.5]
min_lesson_length: 100
signal_smoothing: true
parameters:
param1: [0.0, 4.0, 6.0, 8.0]
"""
)
should_be_config = CurriculumSettings(
thresholds=[0.1, 0.3, 0.5],
min_lesson_length=100,
signal_smoothing=True,
measure=CurriculumSettings.MeasureType.PROGRESS,
parameters={"param1": [0.0, 4.0, 6.0, 8.0]},
)
assert cattr.structure(config, CurriculumSettings) == should_be_config
def test_curriculum_config(param_name="test_param1", min_lesson_length=100):

正在加载...
取消
保存