简体   繁体   English

运行代理场景时“期望用双引号括起来的属性名称”

[英]"Expecting property name enclosed in double quotes" when running agents scene

In summary, I have a pair of legs that have rotation-axis-points and want to be able to allow the computer to figure out which way the legs should rotate to allow itself to balance and keep the 'waist' game-object greater than a certain height (Essentially self-balancing ).总之,我有一双腿有旋转轴点,并希望能够让计算机找出腿应该旋转的方向以允许自己平衡并保持“腰部”游戏对象大于一定的高度(基本上是自平衡的)。 If the waist falls under a certain height, (IE, falling over) the agent gets a reward-reduction.如果腰部低于某个高度,(即跌倒)代理将获得奖励减少。 When I run the Anaconda prompt and run Unity when it asks me to, Unity freezes and Anaconda displays the error code shown below.当我运行 Anaconda 提示符并在它要求我运行 Unity 时, Unity 冻结并且 Anaconda 显示如下所示的错误代码。 It's hard to find up-to-date tutorials so I would really appreciate some support.很难找到最新的教程,所以我非常感谢一些支持。 What's going on?这是怎么回事? Thank you.谢谢你。 (: (:

代理环境

                        ▄▄▄▓▓▓▓
                   ╓▓▓▓▓▓▓█▓▓▓▓▓
              ,▄▄▄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.

And here is my code for the agent:这是我的代理代码:

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);
    }
}

It is having trouble finding and loading the curriculua in the specified curriculum_folder parameter.在指定的curriculum_folder文件curriculum_folder参数中查找和加载课程时遇到问题。 Because you don't need curricula, you can remove the curriculum_folder parameter and it will proceed without trying to load any of them.因为您不需要课程,所以您可以删除curriculum_folder参数,它会继续而不尝试加载任何curriculum_folder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM