Skip to content

Commit 583e3f4

Browse files
author
Ervin T
authored
[bug-fix] Fix issue where curriculum was advancing too early (#4107)
1 parent dc43c8d commit 583e3f4

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ml-agents/mlagents/trainers/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class MeasureType:
259259
REWARD: str = "reward"
260260

261261
measure: str = attr.ib(default=MeasureType.REWARD)
262-
thresholds: List[int] = attr.ib(factory=list)
262+
thresholds: List[float] = attr.ib(factory=list)
263263
min_lesson_length: int = 0
264264
signal_smoothing: bool = True
265265
parameters: Dict[str, List[float]] = attr.ib(kw_only=True)

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
22
from unittest.mock import patch, Mock, call
3+
import yaml
4+
import cattr
35

46
from mlagents.trainers.meta_curriculum import MetaCurriculum
57

@@ -24,6 +26,27 @@ def reward_buff_sizes():
2426
return {"Brain1": 7, "Brain2": 8}
2527

2628

29+
def test_convert_from_dict():
30+
config = yaml.safe_load(
31+
"""
32+
measure: progress
33+
thresholds: [0.1, 0.3, 0.5]
34+
min_lesson_length: 100
35+
signal_smoothing: true
36+
parameters:
37+
param1: [0.0, 4.0, 6.0, 8.0]
38+
"""
39+
)
40+
should_be_config = CurriculumSettings(
41+
thresholds=[0.1, 0.3, 0.5],
42+
min_lesson_length=100,
43+
signal_smoothing=True,
44+
measure=CurriculumSettings.MeasureType.PROGRESS,
45+
parameters={"param1": [0.0, 4.0, 6.0, 8.0]},
46+
)
47+
assert cattr.structure(config, CurriculumSettings) == should_be_config
48+
49+
2750
def test_curriculum_config(param_name="test_param1", min_lesson_length=100):
2851
return CurriculumSettings(
2952
thresholds=[0.1, 0.3, 0.5],

0 commit comments

Comments
 (0)