"Expecting property name enclosed in double quotes"当运行特工现场
"Expecting property name enclosed in double quotes" when running agents scene
总而言之,我有一对具有旋转轴点的腿,希望能够让计算机计算出腿应该旋转的方向,以使其自身保持平衡并保持 'waist' game-object 大于一定高度(本质上是self-balancing)。如果腰部低于某个高度,(即,摔倒)代理人将获得奖励减少。当我 运行 Anaconda 提示和 运行 Unity 当它要求我时,Unity 冻结 并且 Anaconda 显示如下所示的错误代码。很难找到最新的教程,所以我非常感谢您的支持。 怎么回事?谢谢。 (:
▄▄▄▓▓▓▓
╓▓▓▓▓▓▓█▓▓▓▓▓
,▄▄▄m▀▀▀' ,▓▓▓▀▓▓▄ ▓▓▓ ▓▓▌
▄▓▓▓▀' ▄▓▓▀ ▓▓▓ ▄▄ ▄▄ ,▄▄ ▄▄▄▄ ,▄▄ ▄▓▓▌▄ ▄▄▄ ,▄▄
▄▓▓▓▀ ▄▓▓▀ ▐▓▓▌ ▓▓▌ ▐▓▓ ▐▓▓▓▀▀▀▓▓▌ ▓▓▓ ▀▓▓▌▀ ^▓▓▌ ╒▓▓▌
▄▓▓▓▓▓▄▄▄▄▄▄▄▄▓▓▓ ▓▀ ▓▓▌ ▐▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▌ ▐▓▓▄ ▓▓▌
▀▓▓▓▓▀▀▀▀▀▀▀▀▀▀▓▓▄ ▓▓ ▓▓▌ ▐▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▌ ▐▓▓▐▓▓
^█▓▓▓ ▀▓▓▄ ▐▓▓▌ ▓▓▓▓▄▓▓▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▓▄ ▓▓▓▓`
'▀▓▓▓▄ ^▓▓▓ ▓▓▓ └▀▀▀▀ ▀▀ ^▀▀ `▀▀ `▀▀ '▀▀ ▐▓▓▌
▀▀▀▀▓▄▄▄ ▓▓▓▓▓▓, ▓▓▓▓▀
`▀█▓▓▓▓▓▓▓▓▓▌
¬`▀▀▀█▓
INFO:mlagents.trainers:CommandLineOptions(debug=False, num_runs=1, seed=-1, env_path=None, run_id='testRun1', load_model=False, train_model=False, save_freq=50000, keep_checkpoints=5, base_port=5005, num_envs=1, curriculum_folder='config/curricula/Balance/', lesson=0, slow=False, no_graphics=False, multi_gpu=False, trainer_config_path='config/trainer_config.yaml', sampler_file_path=None, docker_target_name=None, env_args=None, cpu=False)
INFO:mlagents.envs:Start training by pressing the Play button in the Unity Editor.
INFO:mlagents.envs:
'BalanceAcademy' started successfully!
Unity Academy name: BalanceAcademy
Reset Parameters : {}
Traceback (most recent call last):
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 132, in _load_curriculum
return json.load(fp)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 112)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\Scripts\mlagents-learn-script.py", line 11, in <module>
load_entry_point('mlagents', 'console_scripts', 'mlagents-learn')()
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 422, in main
run_training(0, run_seed, options, Queue())
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 232, in run_training
curriculum_folder, env, options.lesson
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 300, in try_create_meta_curriculum
meta_curriculum = MetaCurriculum(curriculum_folder, env.reset_parameters)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\meta_curriculum.py", line 43, in __init__
curriculum = Curriculum(curriculum_filepath, default_reset_parameters)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 26, in __init__
self.data = Curriculum.load_curriculum_file(location)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 119, in load_curriculum_file
return Curriculum._load_curriculum(data_file)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 137, in _load_curriculum
) from e
mlagents.trainers.exception.CurriculumLoadingError: Error parsing JSON file. Please check for formatting errors. A tool such as https://jsonlint.com/ can be helpful with this.
这是我的代理代码:
using MLAgents;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BalanceAgent : Agent
{
private BalancingArea area;
public GameObject waist;
public GameObject buttR;
public GameObject buttL;
public GameObject thighR;
public GameObject thighL;
public GameObject legR;
public GameObject legL;
public GameObject footR;
public GameObject footL;
public GameObject goal;
// private float buttR = 0f;
public override void InitializeAgent() {
base.InitializeAgent();
area = GetComponentInParent<BalancingArea>();
}
public override void AgentAction(float[] vectorAction) {
int buttRDir = 0;
int buttRVec = (int)vectorAction[0];
switch (buttRVec) {
case 3:
buttRDir = 0;
break;
case 1:
buttRDir = -1;
break;
case 2:
buttRDir = 1;
break;
}
buttR.transform.Rotate(0, buttRDir, 0);
int buttLDir = 0;
int buttLVec = (int)vectorAction[1];
switch (buttLVec) {
case 3:
buttLDir = 0;
break;
case 1:
buttLDir = -1;
break;
case 2:
buttLDir = 1;
break;
}
buttL.transform.Rotate(0, buttLDir, 0);
int thighRDir = 0;
int thighRVec = (int)vectorAction[2];
switch (thighRVec) {
case 3:
thighRDir = 0;
break;
case 1:
thighRDir = -1;
break;
case 2:
thighRDir = 1;
break;
}
thighR.transform.Rotate(0, thighRDir, 0);
int thighLDir = 0;
int thighLVec = (int)vectorAction[3];
switch (thighLVec) {
case 3:
thighLDir = 0;
break;
case 1:
thighLDir = -1;
break;
case 2:
thighLDir = 1;
break;
}
thighL.transform.Rotate(0, thighLDir, 0);
int legRDir = 0;
int legRVec = (int)vectorAction[4];
switch (legRVec) {
case 3:
legRDir = 0;
break;
case 1:
legRDir = -1;
break;
case 2:
legRDir = 1;
break;
}
legR.transform.Rotate(0, legRDir, 0);
int legLDir = 0;
int legLVec = (int)vectorAction[5];
switch (legLVec) {
case 3:
legLDir = 0;
break;
case 1:
legLDir = -1;
break;
case 2:
legLDir = 1;
break;
}
legL.transform.Rotate(0, legLDir, 0);
int footRDir = 0;
int footRVec = (int)vectorAction[6];
switch (footRVec) {
case 3:
footRDir = 0;
break;
case 1:
footRDir = -1;
break;
case 2:
footRDir = 1;
break;
}
footR.transform.Rotate(0, footRDir, 0);
int footLDir = 0;
int footLVec = (int)vectorAction[7];
switch (footLVec) {
case 3:
footLDir = 0;
break;
case 1:
footLDir = -1;
break;
case 2:
footLDir = 1;
break;
}
footL.transform.Rotate(0, footLDir, 0);
//buttR = vectorAction[0]; //Right or none
//if (buttR == 2) buttR = -1f; //Left
if (waist.transform.position.y > -1.3) {
AddReward(.1f);
}
else {
AddReward(-.02f);
}
if(waist.transform.position.y <= -3) {
AddReward(-.1f);
Done();
}
}
public override void CollectObservations() {
AddVectorObs(waist.transform.localRotation.y);
AddVectorObs(buttR.transform.localRotation.x);
AddVectorObs(buttL.transform.localRotation.x);
AddVectorObs(thighR.transform.localRotation.y);
AddVectorObs(thighL.transform.localRotation.y);
AddVectorObs(legR.transform.localRotation.y);
AddVectorObs(legL.transform.localRotation.y);
AddVectorObs(footR.transform.localRotation.y);
AddVectorObs(footL.transform.localRotation.y);
AddVectorObs(waist.GetComponent<Rigidbody>().freezeRotation);
}
}
在指定的 curriculum_folder
参数中查找和加载课程表时遇到问题。因为您不需要课程,您可以删除 curriculum_folder
参数,它会继续而不尝试加载任何课程。
总而言之,我有一对具有旋转轴点的腿,希望能够让计算机计算出腿应该旋转的方向,以使其自身保持平衡并保持 'waist' game-object 大于一定高度(本质上是self-balancing)。如果腰部低于某个高度,(即,摔倒)代理人将获得奖励减少。当我 运行 Anaconda 提示和 运行 Unity 当它要求我时,Unity 冻结 并且 Anaconda 显示如下所示的错误代码。很难找到最新的教程,所以我非常感谢您的支持。 怎么回事?谢谢。 (:
▄▄▄▓▓▓▓
╓▓▓▓▓▓▓█▓▓▓▓▓
,▄▄▄m▀▀▀' ,▓▓▓▀▓▓▄ ▓▓▓ ▓▓▌
▄▓▓▓▀' ▄▓▓▀ ▓▓▓ ▄▄ ▄▄ ,▄▄ ▄▄▄▄ ,▄▄ ▄▓▓▌▄ ▄▄▄ ,▄▄
▄▓▓▓▀ ▄▓▓▀ ▐▓▓▌ ▓▓▌ ▐▓▓ ▐▓▓▓▀▀▀▓▓▌ ▓▓▓ ▀▓▓▌▀ ^▓▓▌ ╒▓▓▌
▄▓▓▓▓▓▄▄▄▄▄▄▄▄▓▓▓ ▓▀ ▓▓▌ ▐▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▌ ▐▓▓▄ ▓▓▌
▀▓▓▓▓▀▀▀▀▀▀▀▀▀▀▓▓▄ ▓▓ ▓▓▌ ▐▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▌ ▐▓▓▐▓▓
^█▓▓▓ ▀▓▓▄ ▐▓▓▌ ▓▓▓▓▄▓▓▓▓ ▐▓▓ ▓▓▓ ▓▓▓ ▓▓▓▄ ▓▓▓▓`
'▀▓▓▓▄ ^▓▓▓ ▓▓▓ └▀▀▀▀ ▀▀ ^▀▀ `▀▀ `▀▀ '▀▀ ▐▓▓▌
▀▀▀▀▓▄▄▄ ▓▓▓▓▓▓, ▓▓▓▓▀
`▀█▓▓▓▓▓▓▓▓▓▌
¬`▀▀▀█▓
INFO:mlagents.trainers:CommandLineOptions(debug=False, num_runs=1, seed=-1, env_path=None, run_id='testRun1', load_model=False, train_model=False, save_freq=50000, keep_checkpoints=5, base_port=5005, num_envs=1, curriculum_folder='config/curricula/Balance/', lesson=0, slow=False, no_graphics=False, multi_gpu=False, trainer_config_path='config/trainer_config.yaml', sampler_file_path=None, docker_target_name=None, env_args=None, cpu=False)
INFO:mlagents.envs:Start training by pressing the Play button in the Unity Editor.
INFO:mlagents.envs:
'BalanceAcademy' started successfully!
Unity Academy name: BalanceAcademy
Reset Parameters : {}
Traceback (most recent call last):
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 132, in _load_curriculum
return json.load(fp)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 6 column 1 (char 112)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Jaden Williams\.conda\envs\ml_Balance01\Scripts\mlagents-learn-script.py", line 11, in <module>
load_entry_point('mlagents', 'console_scripts', 'mlagents-learn')()
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 422, in main
run_training(0, run_seed, options, Queue())
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 232, in run_training
curriculum_folder, env, options.lesson
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\learn.py", line 300, in try_create_meta_curriculum
meta_curriculum = MetaCurriculum(curriculum_folder, env.reset_parameters)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\meta_curriculum.py", line 43, in __init__
curriculum = Curriculum(curriculum_filepath, default_reset_parameters)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 26, in __init__
self.data = Curriculum.load_curriculum_file(location)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 119, in load_curriculum_file
return Curriculum._load_curriculum(data_file)
File "c:\users\jaden williams\dropbox\documents\ml-agents-0.12.0\ml-agents\mlagents\trainers\curriculum.py", line 137, in _load_curriculum
) from e
mlagents.trainers.exception.CurriculumLoadingError: Error parsing JSON file. Please check for formatting errors. A tool such as https://jsonlint.com/ can be helpful with this.
这是我的代理代码:
using MLAgents;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BalanceAgent : Agent
{
private BalancingArea area;
public GameObject waist;
public GameObject buttR;
public GameObject buttL;
public GameObject thighR;
public GameObject thighL;
public GameObject legR;
public GameObject legL;
public GameObject footR;
public GameObject footL;
public GameObject goal;
// private float buttR = 0f;
public override void InitializeAgent() {
base.InitializeAgent();
area = GetComponentInParent<BalancingArea>();
}
public override void AgentAction(float[] vectorAction) {
int buttRDir = 0;
int buttRVec = (int)vectorAction[0];
switch (buttRVec) {
case 3:
buttRDir = 0;
break;
case 1:
buttRDir = -1;
break;
case 2:
buttRDir = 1;
break;
}
buttR.transform.Rotate(0, buttRDir, 0);
int buttLDir = 0;
int buttLVec = (int)vectorAction[1];
switch (buttLVec) {
case 3:
buttLDir = 0;
break;
case 1:
buttLDir = -1;
break;
case 2:
buttLDir = 1;
break;
}
buttL.transform.Rotate(0, buttLDir, 0);
int thighRDir = 0;
int thighRVec = (int)vectorAction[2];
switch (thighRVec) {
case 3:
thighRDir = 0;
break;
case 1:
thighRDir = -1;
break;
case 2:
thighRDir = 1;
break;
}
thighR.transform.Rotate(0, thighRDir, 0);
int thighLDir = 0;
int thighLVec = (int)vectorAction[3];
switch (thighLVec) {
case 3:
thighLDir = 0;
break;
case 1:
thighLDir = -1;
break;
case 2:
thighLDir = 1;
break;
}
thighL.transform.Rotate(0, thighLDir, 0);
int legRDir = 0;
int legRVec = (int)vectorAction[4];
switch (legRVec) {
case 3:
legRDir = 0;
break;
case 1:
legRDir = -1;
break;
case 2:
legRDir = 1;
break;
}
legR.transform.Rotate(0, legRDir, 0);
int legLDir = 0;
int legLVec = (int)vectorAction[5];
switch (legLVec) {
case 3:
legLDir = 0;
break;
case 1:
legLDir = -1;
break;
case 2:
legLDir = 1;
break;
}
legL.transform.Rotate(0, legLDir, 0);
int footRDir = 0;
int footRVec = (int)vectorAction[6];
switch (footRVec) {
case 3:
footRDir = 0;
break;
case 1:
footRDir = -1;
break;
case 2:
footRDir = 1;
break;
}
footR.transform.Rotate(0, footRDir, 0);
int footLDir = 0;
int footLVec = (int)vectorAction[7];
switch (footLVec) {
case 3:
footLDir = 0;
break;
case 1:
footLDir = -1;
break;
case 2:
footLDir = 1;
break;
}
footL.transform.Rotate(0, footLDir, 0);
//buttR = vectorAction[0]; //Right or none
//if (buttR == 2) buttR = -1f; //Left
if (waist.transform.position.y > -1.3) {
AddReward(.1f);
}
else {
AddReward(-.02f);
}
if(waist.transform.position.y <= -3) {
AddReward(-.1f);
Done();
}
}
public override void CollectObservations() {
AddVectorObs(waist.transform.localRotation.y);
AddVectorObs(buttR.transform.localRotation.x);
AddVectorObs(buttL.transform.localRotation.x);
AddVectorObs(thighR.transform.localRotation.y);
AddVectorObs(thighL.transform.localRotation.y);
AddVectorObs(legR.transform.localRotation.y);
AddVectorObs(legL.transform.localRotation.y);
AddVectorObs(footR.transform.localRotation.y);
AddVectorObs(footL.transform.localRotation.y);
AddVectorObs(waist.GetComponent<Rigidbody>().freezeRotation);
}
}
在指定的 curriculum_folder
参数中查找和加载课程表时遇到问题。因为您不需要课程,您可以删除 curriculum_folder
参数,它会继续而不尝试加载任何课程。