#Please help me set up ml agents

1 messages · Page 1 of 1 (latest)

glass iris
#

Hi, I'm trying to do ml agents 4.0.0 unity 600.0.64f1 python 3.10.11 I did as in the tutorial but nothing works can Hi I am trying to do ml agents 4.0.0 unity 600.0.64f1 python 3.10.11 I did as in the tutorial but nothing works can help 🥺

onyx flint
glass iris
#

I read the documentation, nothing worked out, and the video on YouTube is from Russia

onyx flint
#

Well, you'll need to provide details on your setup and issues.

#

Ideally, reset everything and flow the docs. Then if there are still issues, share the info here.

onyx flint
#

Could also use venv or some other simpler alternative.

glass iris
#

What to do

glass iris
onyx flint
# glass iris What to do

For starters, avoid taking photos. Make it screenshots.

Second, this is not really an error, and honestly it's probably not a problem at all.

#

I'm not sure if it's fixabale. It seems to be an common bug lately.

glass iris
#

@onyx flint And what is my mistake

onyx flint
#

Share code properly:

#

!code

fierce lindenBOT
onyx flint
# glass iris

The errors mean that a component or an object having the component was destroyed, yet you still try to access it.

glass iris
onyx flint
#

You need to use backticks: ```

glass iris
#
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.Sensors;
using Unity.MLAgents.Actuators;

public class plAge : Agent
{
    [SerializeField] private Transform targetTransform;
    [SerializeField] private Material winMatearil;
    [SerializeField] private Material loseMatest;
    [SerializeField] private MeshRenderer plabeMeshRederer;

    public override void CollectObservations(VectorSensor sensor)
    {
        sensor.AddObservation(transform.localPosition);
        sensor.AddObservation(targetTransform.localPosition);
    }

    public override void OnActionReceived(ActionBuffers actions)
    {
        float moveX = actions.ContinuousActions[0];
        float moveZ = actions.ContinuousActions[1];

        float speed = 25f;
        transform.localPosition += new Vector3(moveX, 0, moveZ) * Time.deltaTime * speed;
    }

    public override void Heuristic(in ActionBuffers actionsOut)
    {
        ActionSegment<float> continuonsActions = actionsOut.ContinuousActions;
        continuonsActions[0] = Input.GetAxisRaw("Horizontal");
        continuonsActions[1] = Input.GetAxisRaw("Vertical");
    }

    private void OnTriggerEnter(Collider other)
    {
        if(other.TryGetComponent<Wall>(out Wall wall))
        {
            SetReward(-1f);
            plabeMeshRederer.material = loseMatest;
            EndEpisode();
        }
        if(other.TryGetComponent<Tar>(out Tar tar))
        {
            SetReward(+1f);
            plabeMeshRederer.material = winMatearil;
            EndEpisode();
        }
    }
}
onyx flint
# glass iris

Click one of the errors and share it's details in the bottom.

onyx flint
#

This seems to be thrown by the inspector ui, not your code. I'd assume the Agent script ui specifically. Is there actually an issue with it? Because I think you can just ignore this error.

onyx flint
glass iris
onyx flint
onyx flint
glass iris
#

I still tried to control it, but it didn't work.

onyx flint
#

This is definitely wrong. You're not supposed to use the Agent base class.

glass iris
onyx flint
#

This doesn't look like the sample scene from the docs.

glass iris
onyx flint
# glass iris I don't have any of their scenes, and if I download them from GitHub, everything...

The samples should be installable with the package(might need to click the samples button in the package manager).

Environments are located in Project/Assets/ML-Agents/Examples

https://docs.unity3d.com/Packages/com.unity.ml-agents@4.0/manual/Learning-Environment-Examples.html

As for everything being pink, you probably need to convert the materials to use shaders of your selected render pipeline. This is a completely different and unrelated issue that you should know how to solve.

glass iris
#

There's a script error and everything is rosy.

onyx flint
#

It seems to be listed in the package dependencies, so it was supposed to be installed with the ml agents package.🤔

#

Ah, nevermind. It's listed in the github repo packages manifset, not the dependencies. So you need to install it manually.

glass iris
onyx flint
glass iris
glass iris
glass iris