samuelscheit / carcassonne-ai Goto Github PK
View Code? Open in Web Editor NEWArtificial intelligence for the game Carcassonne
License: GNU General Public License v2.0
Artificial intelligence for the game Carcassonne
License: GNU General Public License v2.0
I tried testing the models that you've trained in src/results/carcassonne2/ using the testing code in muzero.py (running the script, picking 1
to load the model and then 3
to self play) and I'm getting some strange results.
In the screenshot below, you can see that many of the moves being made are illegal. I suspect that this is either an issue with the way that legal actions are defined in https://github.com/Flam3rboy/carcassonne-ai/blob/a3a96cc0650538d78bc60e78ecf73b6e013b279d/src/muzero/carcassonne/utils/action_util.py#L43-L76
Alternatively, it might be that the interpretation of selected actions is off.
I'm happy to help fix the problem, but on first glance, I didn't quite understand how ActionUtil works. Do you have any ideas here? It's also entirely possible that I'm using the code in the wrong way or that I've misunderstood something else, so let me know if that's the case!
This error happened when I try "3. Render some self play games"
I try a few day, but I can't fix it.
Exception has occurred: RayTaskError(AttributeError)
�[36mray::SelfPlay.play_game()�[39m (pid=13172, ip=127.0.0.1, repr=<self_play.SelfPlay object at 0x0000027D88204C70>)
File "python\ray_raylet.pyx", line 663, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 667, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 614, in ray._raylet.execute_task.function_executor
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray_private\function_manager.py", line 701, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray\util\tracing\tracing_helper.py", line 462, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\self_play.py", line 124, in play_game
self.game.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne2.py", line 218, in render
self.env.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne\carcassonne_game.py", line 60, in render
self.visualiser.draw_game_state(self.state)
AttributeError: 'NoneType' object has no attribute 'draw_game_state'
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\muzero.py", line 402, in test
ray.get(
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\muzero.py", line 677, in
muzero.test(render=True, opponent="human", muzero_player=0)
ray.exceptions.RayTaskError(AttributeError): �[36mray::SelfPlay.play_game()�[39m (pid=13172, ip=127.0.0.1, repr=<self_play.SelfPlay object at 0x0000027D88204C70>)
File "python\ray_raylet.pyx", line 663, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 667, in ray._raylet.execute_task
File "python\ray_raylet.pyx", line 614, in ray._raylet.execute_task.function_executor
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray_private\function_manager.py", line 701, in actor_method_executor
return method(__ray_actor, *args, **kwargs)
File "C:\Users\s0708.conda\envs\muzero\lib\site-packages\ray\util\tracing\tracing_helper.py", line 462, in _resume_span
return method(self, *_args, **_kwargs)
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\self_play.py", line 124, in play_game
self.game.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne2.py", line 218, in render
self.env.render()
File "C:\Users\s0708\Desktop\carcassonne-ai-main\src\muzero\carcassonne\carcassonne_game.py", line 60, in render
self.visualiser.draw_game_state(self.state)
AttributeError: 'NoneType' object has no attribute 'draw_game_state'
Is this code below cause this problem?
In carcassonne2.py
class Game(AbstractGame):
"""
Game wrapper.
"""
def __init__(self, seed=None):
self.env = CarcassonneGame(players=2,
tile_sets=[TileSet.BASE],
supplementary_rules=[],
visualiser=None)
My enviroment is
python=3.9.17
numpy=1.25.2
torch=2.0.1
tensorboard=2.10.0
gym=0.26.2
ray=1.12.0
seaborn=0.12.2
nevergrad=0.12.0
redis=5.0.0
graphviz=0.20.1
May you share your current requirement? Thanks a lot. 🙏🙏
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.