Closed benzhangdragonplus closed 7 months ago
Did you upgrade from a previous version of MLA? If so, It may be that you need to delete your package cache as it might be causing conflicts. Barracuda was deprecated with the last release. Seems like you have an old version of MLA that is causing conflicts. You can see here that there's no mention of Barracuda in the BehaviorParameters script: https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
Did you upgrade from a previous version of MLA? If so, It may be that you need to delete your package cache as it might be causing conflicts. Barracuda was deprecated with the last release. Seems like you have an old version of MLA that is causing conflicts. You can see here that there's no mention of Barracuda in the BehaviorParameters script: https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
Thank you for your reply!!! Yes, the source code does not have Barracuda, but when importing the 3D Balance Ball example, the package has the Barracuda option. Do I need to uncheck it? like this:
Did you upgrade from a previous version of MLA? If so, It may be that you need to delete your package cache as it might be causing conflicts. Barracuda was deprecated with the last release. Seems like you have an old version of MLA that is causing conflicts. You can see here that there's no mention of Barracuda in the BehaviorParameters script: https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
Thank you for your reply!!! Yes, the source code does not have Barracuda, but when importing the 3D Balance Ball example, the package has the Barracuda option. Do I need to uncheck it? like this:
By the way, when I import the examples, the source code content will also change and Barracuda will be automatically added
Oh, I see what the issue is. The 3DBall example package is stale and needs to be updated. I can take care of that. Thanks for submitting the issue.
I've met the same problem, and confused the whole day (cry~).
Hope I've seen this issue early. Anyway, looking for your update~~
I've met the same problem, and confused the whole day (cry~).
Hope I've seen this issue early. Anyway, looking for your update~~
Thanks for your understanding. I'm the only maintainer of ML-Agents currently, so things are bound to slip through the cracks. I should have this update done sometime this week. Thanks for reaching out.
I had the same issue. But @benzhangdragonplus, did uncheck Barracuda package resolve the issue?
For me I think what I did was to install the Barracuda 3.0.0 from package manager and remove the ml-agents.extensions package. Not sure which of those actually helped, but it got me moving forward.
I had the same issue. But @benzhangdragonplus, did uncheck Barracuda package resolve the issue?
For me I think what I did was to install the Barracuda 3.0.0 from package manager and remove the ml-agents.extensions package. Not sure which of those actually helped, but it got me moving forward.
replay: Unchecking doesn't work either. You can use the release 20 version directly, and there is currently no problem. Secondly, the reason for the error is that the 3DBall example has not been updated, while other examples such as match-3 have no issues
Oh, I see what the issue is. The 3DBall example package is stale and needs to be updated. I can take care of that. Thanks for submitting the issue.
Thanks for your hard work ^_^
Same issue here, waiting for the fix!
Fix: https://github.com/Unity-Technologies/ml-agents/pull/6030 Should be merged into develop today.
I'm getting the same issue and I've followed the instructions to install everything successfully. The errors don't show up until you install the ball sample, but they are in a different directory (see first image of issues thread). I'm on: Unity 2022.3.6f1 Windows 11
I re-installed everything and changed the numpy==1.23.0 line 63 in the setup.py file and then downloaded your updated sample and everything works until I get to the training phase of the example. It starts working fine, but then it looks like Unity locks up and the command line gives errors saying its waiting on Unity. The output is: (mlagents) D:\Users\lokia\Documents\Unity\ML Agents 02 Prototype\ml-agents>mlagents-learn config/ppo/3DBall.yaml --run-id=first3DBallRun --force D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\torch__init__.py:614: UserWarning: torch.set_default_tensor_type() is deprecated as of PyTorch 2.1, please use torch.set_default_dtype() and torch.set_default_device() as alternatives. (Triggered internally at ..\torch\csrc\tensor\python_tensor.cpp:453.) _C._set_default_tensor_type(t)
┐ ╖
╓╖╬│╡ ││╬╖╖
╓╖╬│││││┘ ╬│││││╬╖
╖╬│││││╬╜ ╙╬│││││╖╖ ╗╗╗ ╬╬╬╬╖││╦╖ ╖╬││╗╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╜╜╜ ╟╣╣ ╬╬╬╬╬╬╬╬╖│╬╖╖╓╬╪│╓╣╣╣╣╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╒╣╣╖╗╣╣╣╗ ╣╣╣ ╣╣╣╣╣╣ ╟╣╣╖ ╣╣╣ ╬╬╬╬┐ ╙╬╬╬╬│╓╣╣╣╝╜ ╫╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╟╣╣╣╙ ╙╣╣╣ ╣╣╣ ╙╟╣╣╜╙ ╫╣╣ ╟╣╣ ╬╬╬╬┐ ╙╬╬╣╣ ╫╣╣╣╬ ╟╣╣╬ ╟╣╣╣ ╟╣╣╬ ╣╣╣ ╣╣╣ ╟╣╣ ╣╣╣┌╣╣╜ ╬╬╬╜ ╬╬╣╣ ╙╝╣╣╬ ╙╣╣╣╗╖╓╗╣╣╣╜ ╟╣╣╬ ╣╣╣ ╣╣╣ ╟╣╣╦╓ ╣╣╣╣╣ ╙ ╓╦╖ ╬╬╣╣ ╓╗╗╖ ╙╝╣╣╣╣╝╜ ╘╝╝╜ ╝╝╝ ╝╝╝ ╙╣╣╣ ╟╣╣╣ ╩╬╬╬╬╬╬╦╦╬╬╣╣╗╣╣╣╣╣╣╣╝ ╫╣╣╣╣ ╙╬╬╬╬╬╬╬╣╣╣╣╣╣╝╜ ╙╬╬╬╣╣╣╜ ╙
Version information:
ml-agents: 1.0.0,
ml-agents-envs: 1.0.0,
Communicator API: 1.5.0,
PyTorch: 2.1.1+cpu
D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\torch__init.py:614: UserWarning: torch.set_default_tensor_type() is deprecated as of PyTorch 2.1, please use torch.set_default_dtype() and torch.set_default_device() as alternatives. (Triggered internally at ..\torch\csrc\tensor\python_tensor.cpp:453.)
_C._set_default_tensor_type(t)
[INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
[INFO] Connected to Unity environment with package version 3.0.0-exp.1 and communication version 1.5.0
[INFO] Connected new brain: 3DBall?team=0
[WARNING] Deleting TensorBoard data events.out.tfevents.1702495905.Lokiare.42372.0 that was left over from a previous run.
[INFO] Hyperparameters for behavior name 3DBall:
trainer_type: ppo
hyperparameters:
batch_size: 64
buffer_size: 12000
learning_rate: 0.0003
beta: 0.001
epsilon: 0.2
lambd: 0.99
num_epoch: 3
shared_critic: False
learning_rate_schedule: linear
beta_schedule: linear
epsilon_schedule: linear
checkpoint_interval: 500000
network_settings:
normalize: True
hidden_units: 128
num_layers: 2
vis_encode_type: simple
memory: None
goal_conditioning_type: hyper
deterministic: False
reward_signals:
extrinsic:
gamma: 0.99
strength: 1.0
network_settings:
normalize: False
hidden_units: 128
num_layers: 2
vis_encode_type: simple
memory: None
goal_conditioning_type: hyper
deterministic: False
init_path: None
keep_checkpoints: 5
even_checkpoints: False
max_steps: 500000
time_horizon: 1000
summary_freq: 12000
threaded: False
self_play: None
behavioral_cloning: None
[INFO] 3DBall. Step: 12000. Time Elapsed: 16.267 s. Mean Reward: 1.127. Std of Reward: 0.751. Training.
[WARNING] Restarting worker[0] after 'The Unity environment took too long to respond. Make sure that :
The environment does not need user interaction to launch
The Agents' Behavior Parameters > Behavior Type is set to "Default"
The environment and the Python interface have compatible versions.
If you're running on a headless server without graphics support, turn off display by either passing --no-graphics option or build your Unity executable as server build.'
D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\torch__init__.py:614: UserWarning: torch.set_default_tensor_type() is deprecated as of PyTorch 2.1, please use torch.set_default_dtype() and torch.set_default_device() as alternatives. (Triggered internally at ..\torch\csrc\tensor\python_tensor.cpp:453.)
_C._set_default_tensor_type(t)
[INFO] Listening on port 5004. Start training by pressing the Play button in the Unity Editor.
[ERROR] UnityEnvironment worker 0: environment raised an unexpected exception.
Traceback (most recent call last):
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\mlagents\trainers\subprocess_env_manager.py", line 163, in worker
env = env_factory(worker_id, side_channels)
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\mlagents\trainers\learn.py", line 189, in create_unity_environment
return UnityEnvironment(
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\mlagents_envs\environment.py", line 242, in init__
if not UnityEnvironment._check_communication_compatibility(
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\site-packages\mlagents_envs\environment.py", line 96, in _check_communication_compatibility
if unity_communicator_version.version[0] == 0:
AttributeError: 'StrictVersion' object has no attribute 'version'
[INFO] Exported results\first3DBallRun\3DBall\3DBall-12102.onnx
[INFO] Copied results\first3DBallRun\3DBall\3DBall-12102.onnx to results\first3DBallRun\3DBall.onnx.
Traceback (most recent call last):
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "D:\Users\lokia\anaconda3\envs\mlagents\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Users\lokia\anaconda3\envs\mlagents\Scripts\mlagents-learn.exe__main__.py", line 7, in
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale. Please open a new issue for related bugs.
I am still facing this issue. Upon further checking, it seems like it is only fixed for the develop branch but not yet pushed to the latest release branch. "release-21" still suffers with this issue and imports Barracuda in "com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs" in the first line of the code.
For reference this is my process to install ML-Agents:
C:\ml-agents\com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(1,13): error CS0234: The type or namespace name 'Barracuda' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
C:\ml-agents\com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(105,16): error CS0246: The type or namespace name 'NNModel' could not be found (are you missing a using directive or an assembly reference?)
C:\ml-agents\com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(98,9): error CS0246: The type or namespace name 'NNModel' could not be found (are you missing a using directive or an assembly reference?)
D:\Unity\packages\ml-agents-release_21\com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(1,13): error CS0234: The type or namespace name 'Barracuda' does not exist in the namespace 'Unity' (are you missing an assembly reference?) THAT IS ALL ...SO HOW?
Here's what I did: I clicked the console tab on Unity and checked for all compliation issues. Then I went to the branch the maintainer above noted: https://github.com/Unity-Technologies/ml-agents/pull/6030. I opened the files that were throwing errors in VSCode. I found the same files in the pull request. I replaced the local versions of my files with the ones on the pull request.
It seems like the tutorial asks you to clone a stale branch version with outdated assets.
For example, I saw that dragging and dropping Assets/ML-Agents/Examples/3DBall/TFModels/3DBall.nn into the agent's model field didn't work. I had to download 3dBall, 3dBallHard, Visual3DBall etc. into Assets/ML-Agents/Examples/3DBall/TFModels and fix that.
Here's what I did: I clicked the console tab on Unity and checked for all compliation issues. Then I went to the branch the maintainer above noted: #6030. I opened the files that were throwing errors in VSCode. I found the same files in the pull request. I replaced the local versions of my files with the ones on the pull request.
It seems like the tutorial asks you to clone a stale branch version with outdated assets.
Thank you for your solution @RishiMalhotra920 it worked for me. To complement with further details I followed his solution quoted above and replaced the following files exactly:
com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs from https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs from https://github.com/Unity-Technologies/ml-agents/blob/develop/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs
Here's what I did: I clicked the console tab on Unity and checked for all compliation issues. Then I went to the branch the maintainer above noted: #6030. I opened the files that were throwing errors in VSCode. I found the same files in the pull request. I replaced the local versions of my files with the ones on the pull request. It seems like the tutorial asks you to clone a stale branch version with outdated assets.
Thank you for your solution @RishiMalhotra920 it worked for me. To complement with further details I followed his solution quoted above and replaced the following files exactly:
* com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs from https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs * Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs from https://github.com/Unity-Technologies/ml-agents/blob/develop/Project/Assets/ML-Agents/Examples/SharedAssets/Scripts/ModelOverrider.cs
Thank you, I have solved my problem
Describe the bug After importing the ML Agents package, there is an issue with the namespace prompt: “com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(1,13): error CS0234: The type or namespace name 'Barracuda' does not exist in the namespace 'Unity' (are you missing an assembly reference?)“
“com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(105,16): error CS0246: The type or namespace name 'NNModel' could not be found (are you missing a using directive or an assembly reference?)”
“com.unity.ml-agents\Runtime\Policies\BehaviorParameters.cs(98,9): error CS0246: The type or namespace name 'NNModel' could not be found (are you missing a using directive or an assembly reference?)”
Environment (please complete the following information):