#Problem with ML agents

1 messages · Page 1 of 1 (latest)

stuck lynx
#

When I finish a training run, (with checkpoints saved), i get this error
TypeError: unhashable type: 'TensorType'
I'm too new to mlagents and AI in general to know what to do
Tried to fix it with chatgpt, but that did nothing at all
I couldnt find the same issue when googling it either, all posts relating to that exact error were not to do with unity

The closest I've come to a solution (i think) was by chatgpt, and that was the different libraries being in slightly incompatible versions
I dont know what versions are compatible, nor where to look up which is compatible with which

Im more than happy to post any relevant version i have of the different libraries, just let me know which library actually matters

zealous socket
#

Are there any details to the error? Like a stack trace.

zealous socket
stuck lynx
# zealous socket How did you install/setup ml agents in your environment?

i followed this video https://www.youtube.com/watch?v=zPFU30tbyKs&list=PLzDRvYVwl53vehwiN_odYJkPBzcqFw110&index=1
but then i made the mistake of trying to transfer all the files to another computer using github
and some files must have gotten messed up
and now even when i try to reinstall, it doesnt do a proper install with correct versions and all of that

🌍 Let's learn how to get started unlocking the POWER of Machine Learning AI in Unity!
📦 Unity Machine Learning Playlist: https://www.youtube.com/playlist?list=PLzDRvYVwl53vehwiN_odYJkPBzcqFw110
🌍 Get my Complete Courses! ✅ https://unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.

ML-Agent...

▶ Play video
zealous socket
#

Try running the commands below in your venv:
pip show mlagents
pip show torch

stuck lynx
# zealous socket Try running the commands below in your venv: `pip show mlagents` `pip show torch...

Name: mlagents
Version: 1.1.0
Summary: Unity Machine Learning Agents
Home-page: https://github.com/Unity-Technologies/ml-agents
Author: Unity Technologies
Author-email: ML-Agents@unity3d.com
License:
Location: c:\users\dean winchester\desktop\escape_from_lab_game\venv\lib\site-packages
Requires: attrs, cattrs, grpcio, h5py, huggingface-hub, mlagents-envs, numpy, onnx, Pillow, protobuf, pypiwin32, pyyaml, six, tensorboard, torch
Required-by:

Name: torch
Version: 2.9.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page:
Author:
Author-email: PyTorch Team packages@pytorch.org
License: BSD-3-Clause
Location: c:\users\dean winchester\desktop\escape_from_lab_game\venv\lib\site-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, typing-extensions
Required-by: mlagents, torchaudio, torchvision

GitHub

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement ...

zealous socket
#

Also this:
pip show onnx

stuck lynx
#

Name: onnx
Version: 1.16.1
Summary: Open Neural Network Exchange
Home-page:
Author:
Author-email: ONNX Contributors onnx-technical-discuss@lists.lfaidata.foundation
License: Apache License v2.0
Location: c:\users\dean winchester\desktop\escape_from_lab_game\venv\lib\site-packages
Requires: numpy, protobuf
Required-by: mlagents, onnxscript

zealous socket
#

According to chat gpt it is indeed version compatability issue.
Try running pip install -U "torch==2.1.0" "onnx==1.13.1" in the venv and see if the issue is reproducible.

stuck lynx
#

i have a hard time trusting chatgpt with solutions now
i tried for quite a while to solve it with chat, and it did not help at all

zealous socket
#

Well what it says makes sense.
Try pinning the versions as above, or perhaps updating onnx to the latest.

stuck lynx
#

things can make sense without actually working
but im trying at least

zealous socket
#

Yeah. I'm not telling you to trust it blindly. I'm telling you to use your head and analyze the things it proposes.
You can debug the python code if you want and dig through the relevant package repository commits if you want. That would likely provide a definite answer.

stuck lynx
#

now the agent cant even train

zealous socket
stuck lynx
#

AttributeError: FLOAT8E4M3FN

zealous socket
#

Hmm...
Try python -m pip install mlagents==1.1.0(might need to swap python with py if it's not on the PATH). According to the docs it should install all the right dependency versions.

#

Also, I'm assuming you have the right python version installed?

stuck lynx
#

well i got it running again by upgrading onnxruntime
but saving an actual model is still a problem

zealous socket
#

make sure torch is updated as well

#

Running the install mlagents should install all the right version of the dependencies, assuming the right python version.

stuck lynx
#

python is on 3.10.11

stuck lynx
zealous socket
#

Hmmm...
What version is onnxscript?
pip show onnxscript

stuck lynx
#

0.1.0.dev20240405

zealous socket
#

That seems to be very old. Try updating it as well

#

That's about the only thing I can say before going to sleep

stuck lynx
#

hm now i get this
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

#

IT WORKS NOW
had to uninstall another library to install a compatible version
it was protobuf pip install protobuf==3.20.*

zealous socket
#

Was gonna suggest nuking the venv and reinstalling according to the documentation page. Might want to consider it of there are more issues.

stuck lynx
#

i was considering it AGAIN

lost rover
#

guys im facing like a lot of problems with unity mlagents

#

i decided fully reinstalling venv

#

can anybody provide me the correct versions i should Install

zealous socket
lost rover
#

thank you so much