浏览代码

[skip ci] adding PluginSettings

/trainer-plugin
Anupam Bhatnagar 4 年前
当前提交
4d19245f
共有 3 个文件被更改,包括 10 次插入10 次删除
  1. 2
      ml-agents/mlagents/trainers/cli_utils.py
  2. 10
      ml-agents/mlagents/trainers/learn.py
  3. 8
      ml-agents/mlagents/trainers/settings.py

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


"--plugins",
default="",
type=str,
nargs=3,
nargs="*",
help="Absolute paths of plugins to be loaded",
required=False
)

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


import sys
import importlib
import pkgutil
from mlagents.trainers.initializer import Initializer
class Initializer:
def __init__(self):
pass
def load(self):
pass
def get_all_subclasses(cls):

for p in paths:
sys.path.append(p)
print(sys.path)
discovered_plugins = {
name: importlib.import_module(name)

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


@attr.s(auto_attribs=True)
class PluginSettings:
plugins: Optional[List[str]] = parser.get_default("plugins")
@attr.s(auto_attribs=True)
class RunOptions(ExportableSettings):
behaviors: DefaultDict[str, TrainerSettings] = attr.ib(
factory=lambda: collections.defaultdict(TrainerSettings)

environment_parameters: Optional[Dict[str, EnvironmentParameterSettings]] = None
checkpoint_settings: CheckpointSettings = attr.ib(factory=CheckpointSettings)
plugin_settings: PluginSettings = attr.ib(factory=PluginSettings)
plugins: List[str] = parser.get_default("plugins")
cattr.register_structure_hook(PluginSettings, strict_to_cls)
cattr.register_structure_hook(EngineSettings, strict_to_cls)
cattr.register_structure_hook(CheckpointSettings, strict_to_cls)
cattr.register_structure_hook(

正在加载...
取消
保存