GithubHelp home page GithubHelp logo

Comments (6)

puyuan1996 avatar puyuan1996 commented on August 25, 2024 1

Hello,

We have identified the cause of the issue, which is due to newer versions of numpy. At present, you can install a compatible version of numpy using the following command after installing LightZero: pip install numpy==1.22.4.

I hope this resolves your problem. And we will work on compatibility with newer versions of numpy.

Best wishes.

from lightzero.

puyuan1996 avatar puyuan1996 commented on August 25, 2024

Hello,

Thank you very much for your interest.

  • Did you install the latest version of LightZero by executing the following commands?
git clone https://github.com/opendilab/LightZero.git
cd LightZero
pip3 install -e .
  • We have been running the following command locally: python -u zoo/board_games/tictactoe/config/tictactoe_muzero_sp_mode_config.py
    and have not encountered any similar issues even with a large number of training steps.

  • Can you specify if this error occurs after the program has been running for a while, or does it appear upon startup? Have you made any modifications to the related config or algorithms? If possible, could you provide more information? This would help us identify the problem and assist you better.

Best regards.

from lightzero.

Cowboy-Lee avatar Cowboy-Lee commented on August 25, 2024

Hello,

Thank you very much for your interest.

  • Did you install the latest version of LightZero by executing the following commands?
git clone https://github.com/opendilab/LightZero.git
cd LightZero
pip3 install -e .
  • We have been running the following command locally: python -u zoo/board_games/tictactoe/config/tictactoe_muzero_sp_mode_config.py
    and have not encountered any similar issues even with a large number of training steps.
  • Can you specify if this error occurs after the program has been running for a while, or does it appear upon startup? Have you made any modifications to the related config or algorithms? If possible, could you provide more information? This would help us identify the problem and assist you better.

Best regards.

This error occurred when the first simulation ended. The error messages are as follows:

Traceback (most recent call last):
File "/home/lyq/projects/LightZero/zoo/board_games/tictactoe/config/tictactoe_muzero_sp_mode_config.py", line 89, in
train_muzero([main_config, create_config], seed=0, max_env_step=max_env_step)
File "/home/lyq/projects/LightZero/lzero/entry/train_muzero.py", line 158, in train_muzero
new_data = collector.collect(train_iter=learner.train_iter, policy_kwargs=collect_kwargs)
File "/home/lyq/projects/LightZero/lzero/worker/muzero_collector.py", line 554, in collect
game_segments[env_id].game_segment_to_array()
File "/home/lyq/projects/LightZero/lzero/mcts/buffer/game_segment.py", line 250, in game_segment_to_array
self.child_visit_segment = np.array(self.child_visit_segment)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (7,) + inhomogeneous part.

It was found through debugging that the values of child_visit_segment, when the error occurred, were as follows:

[[0.12, 0.12, 0.08, 0.08, 0.16, 0.12, 0.08, 0.08, 0.16],
[0.08, 0.16, 0.08, 0.08, 0.12, 0.24, 0.12, 0.12],
[0.2, 0.12, 0.08, 0.08, 0.24, 0.12, 0.16],
[0.2, 0.12, 0.12, 0.12, 0.16, 0.28],
[0.16, 0.4, 0.16, 0.16, 0.12],
[0.24, 0.2, 0.32, 0.24],
[0.32, 0.44, 0.24]]

Then np.array(self.child_visit_segment) was run, and the error occurred.

from lightzero.

Cowboy-Lee avatar Cowboy-Lee commented on August 25, 2024

Hello,

We have identified the cause of the issue, which is due to newer versions of numpy. At present, you can install a compatible version of numpy using the following command after installing LightZero: pip install numpy==1.22.4.

I hope this resolves your problem. And we will work on compatibility with newer versions of numpy.

Best wishes.

Hello,

This method solved my problem. Thank you so much!

Best wishes.

from lightzero.

dan-jacobson avatar dan-jacobson commented on August 25, 2024

Hi, i don't think this issue should be closed -- i've been seeing the same issues trying to use many of the built-in training scripts.

Installing numpy==1.22.4 addresses the problem, but that's not obvious following the installation instructions.

Either this numpy version should be pinned in requirements.txt, or line 250 in mcts/buffer/game_segment.py should be updated to read:
self.child_visit_segment = np.array(self.child_visit_segment, dtype=object)

from lightzero.

puyuan1996 avatar puyuan1996 commented on August 25, 2024

Hello, thank you for your insightful suggestions. We have updated the dependencies and relevant code for numpy on the main branch in this commit. If you have any other questions, please feel free to let us know. Best Wishes.

from lightzero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.