浏览代码

Rename --port commandline arg to --mlagents-port (#3477)

/asymm-envs
GitHub 5 年前
当前提交
b5a3b1de
共有 3 个文件被更改,包括 13 次插入7 次删除
  1. 1
      com.unity.ml-agents/CHANGELOG.md
  2. 5
      com.unity.ml-agents/Runtime/Academy.cs
  3. 14
      ml-agents-envs/mlagents_envs/environment.py

1
com.unity.ml-agents/CHANGELOG.md


- The stepping logic for the Agent and the Academy has been simplified (#3448)
- Update Barracuda to 0.6.0-preview
- The checkpoint file suffix was changed from `.cptk` to `.ckpt` (#3470)
- The command-line argument used to determine the port that an environment will listen on was changed from `--port` to `--mlagents-port`.
- The method `GetStepCount()` on the Agent class has been replaced with the property getter `StepCount`
### Bugfixes

5
com.unity.ml-agents/Runtime/Academy.cs


{
const string k_ApiVersion = "API-15-dev0";
const int k_EditorTrainingPort = 5004;
internal const string k_portCommandLineFlag = "--mlagents-port";
// Lazy initializer pattern, see https://csharpindepth.com/articles/singleton#lazy
static Lazy<Academy> s_Lazy = new Lazy<Academy>(() => new Academy());

// Signals to all the listeners that the academy is being destroyed
internal event Action DestroyAction;
// Signals the Agent that a new step is about to start.
// Signals the Agent that a new step is about to start.
// This will mark the Agent as Done if it has reached its maxSteps.
internal event Action AgentIncrementStep;

var inputPort = "";
for (var i = 0; i < args.Length; i++)
{
if (args[i] == "--port")
if (args[i] == k_portCommandLineFlag)
{
inputPort = args[i + 1];
}

14
ml-agents-envs/mlagents_envs/environment.py


SINGLE_BRAIN_ACTION_TYPES = SCALAR_ACTION_TYPES + (list, np.ndarray)
API_VERSION = "API-15-dev0"
DEFAULT_EDITOR_PORT = 5004
PORT_COMMAND_LINE_ARG = "--mlagents-port"
def __init__(
self,

subprocess_args = [launch_string]
if no_graphics:
subprocess_args += ["-nographics", "-batchmode"]
subprocess_args += ["--port", str(self.port)]
subprocess_args += [
UnityEnvironment.PORT_COMMAND_LINE_ARG,
str(self.port),
]
subprocess_args += args
try:
self.proc1 = subprocess.Popen(

# we created with `xvfb`.
#
docker_ls = (
"exec xvfb-run --auto-servernum"
" --server-args='-screen 0 640x480x24'"
" {0} --port {1}"
).format(launch_string, str(self.port))
f"exec xvfb-run --auto-servernum --server-args='-screen 0 640x480x24'"
f" {launch_string} {UnityEnvironment.PORT_COMMAND_LINE_ARG} {self.port}"
)
self.proc1 = subprocess.Popen(
docker_ls,
stdout=subprocess.PIPE,

正在加载...
取消
保存