浏览代码

use yaml.safe_load instead of yaml.load (#2124)

/develop-generalizationTraining-TrainerController
GitHub 6 年前
当前提交
e916dc48
共有 4 个文件被更改,包括 7 次插入7 次删除
  1. 2
      ml-agents/mlagents/trainers/learn.py
  2. 2
      ml-agents/mlagents/trainers/tests/test_bc.py
  3. 2
      ml-agents/mlagents/trainers/tests/test_ppo.py
  4. 8
      ml-agents/mlagents/trainers/tests/test_trainer_controller.py

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


def load_config(trainer_config_path):
try:
with open(trainer_config_path) as data_file:
trainer_config = yaml.load(data_file)
trainer_config = yaml.safe_load(data_file)
return trainer_config
except IOError:
raise UnityEnvironmentException(

2
ml-agents/mlagents/trainers/tests/test_bc.py


@pytest.fixture
def dummy_config():
return yaml.load(
return yaml.safe_load(
"""
hidden_units: 128
learning_rate: 3.0e-4

2
ml-agents/mlagents/trainers/tests/test_ppo.py


@pytest.fixture
def dummy_config():
return yaml.load(
return yaml.safe_load(
"""
trainer: ppo
batch_size: 32

8
ml-agents/mlagents/trainers/tests/test_trainer_controller.py


@pytest.fixture
def dummy_config():
return yaml.load(
return yaml.safe_load(
"""
default:
trainer: ppo

@pytest.fixture
def dummy_online_bc_config():
return yaml.load(
return yaml.safe_load(
"""
default:
trainer: online_bc

@pytest.fixture
def dummy_offline_bc_config():
return yaml.load(
return yaml.safe_load(
"""
default:
trainer: offline_bc

@pytest.fixture
def dummy_bad_config():
return yaml.load(
return yaml.safe_load(
"""
default:
trainer: incorrect_trainer

正在加载...
取消
保存