Closed vdrumsta closed 4 years ago
Yeah so as it stands you don't have the pickle files that the state class needs.
These can be produced by running the research code to produce the lossy abstractions, but you can also skip loading the pickle files in the state constructor by setting the below parameter to False
on initialisation.
If the pickle files aren't produced and uploaded, then you'll not be able to produce information sets, but you may not need to do this
Thanks for the quick reply! : )
Now that it reaches pp.update_state(state) without any errors, it doesn't look like it actually updates the state of the front end as the table still doesn't have any players around it, it's just a blank table.
The state variable doesn't seem to be an issue as it has all the right properties:
Does the update_state(state) method work correctly for you?
Yeah, so this is what I get when I run the first part of the script in my IPython shell on the right:
Then, once I have added the following:
state: ShortDeckPokerState = get_state()
pp.update_state(state)
It updates the visualisation to this:
The only differency that I have is that I disable the pickling of files
return ShortDeckPokerState(
players=players,
load_pickle_files=False
)
That seems to be the problem, so I tried generating the pickle files by running pluribus-poker-AI\research\blueprint_algo\blueprint_kuhn.py and pluribus-poker-AI\research\blueprint_algo\blueprint_short_deck_poker.py
blueprint_kuhn.py runs fine, but when I try to run blueprint_short_deck_poker.py I get a similar pickle error:
train iter: 0%| | 0/20000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "c:\Users\Vilius\OneDrive\workarea\programming\2020\Python\pluribus-poker-AI\research\blueprint_algo\blueprint_short_deck_poker.py", line 421, in
I noticed that a pickle file pluribus-poker-AI\research\clustering\data\preflop_lossless.pkl so I tried moving that into pluribus-poker-AI\research\blueprint_algo\ folder but I still get the same error
That's not how to produce the pickle files you'll need.
That work is in the abstraction section of the research directory. At the moment we aren't supporting anything we leave in the research/ directory - this is our directory for hacking together ideas, and once they ready, we'll add them to the pluribus/ directory
But we can't really support this until it becomes an official part of the project (i.e until we are confident it works)
For the visualisation code, which again is very much a work in progress, you can initialise the state without the pickle files, in the way that you already have, and then there must be some other issue that is causing you not to have the players appear in the visualisation
If you can find the specific problem on your system that is preventing you from visualising the players I'd be very amenable to fixing it, but at the moment the visualisation is very much WIP so you'll need to debug it yourself as I can't replicate your problem as demonstrated here: https://github.com/fedden/pluribus-poker-AI/issues/63#issuecomment-612916394
Gonna close this until there is a more specific problem to fix!
(I also can't support Windows as I am a Linux/OS X user and don't have a Windows machine to test the software on)
That;s understandable, thanks for the response. When you have the time, would you be able to run update_state with load_pickle_files=False just so I know whether it's due to pickle files or something specific to my setup
Sure thing @worm00111 , in the interests of reproducability, could you paste here the complete script you are calling, so I can call that without any questions of difference?
from plot import PokerPlot
from pluribus.games.short_deck.player import ShortDeckPokerPlayer
from pluribus.games.short_deck.state import ShortDeckPokerState
from pluribus.poker.pot import Pot
def get_state() -> ShortDeckPokerState:
"""Gets a state to visualise"""
n_players = 6
pot = Pot()
players = [
ShortDeckPokerPlayer(player_i=player_i, initial_chips=10000, pot=pot)
for player_i in range(n_players)
]
return ShortDeckPokerState(
players=players,
load_pickle_files=False
)
pp: PokerPlot = PokerPlot()
state: ShortDeckPokerState = get_state()
pp.update_state(state)
Sorry, for the formatting, can't seem to enclose the entire thing in a code block
If you can format it as here that would be helpful to be sure I am running the same code as ou are! https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks
Cheers, updated the message.
Okay great, I can confirm I can replicate the issue. For now the (disgusting/hacky) fix is to insert a lengthly sleep inbetween the call like so:
import time
from plot import PokerPlot
from pluribus.games.short_deck.player import ShortDeckPokerPlayer
from pluribus.games.short_deck.state import ShortDeckPokerState
from pluribus.poker.pot import Pot
def get_state() -> ShortDeckPokerState:
"""Gets a state to visualise"""
n_players = 6
pot = Pot()
players = [
ShortDeckPokerPlayer(player_i=player_i, initial_chips=10000, pot=pot)
for player_i in range(n_players)
]
return ShortDeckPokerState(players=players, load_pickle_files=False)
pp: PokerPlot = PokerPlot()
state: ShortDeckPokerState = get_state()
time.sleep(5)
print("updating state")
pp.update_state(state)
I'll try to dig into this (when I can) and will make sure this works in the future
The reason why I hadn't discovered this previously was because I was running this code in one IPython cell:
import time
from plot import PokerPlot
from pluribus.games.short_deck.player import ShortDeckPokerPlayer
from pluribus.games.short_deck.state import ShortDeckPokerState
from pluribus.poker.pot import Pot
def get_state() -> ShortDeckPokerState:
"""Gets a state to visualise"""
n_players = 6
pot = Pot()
players = [
ShortDeckPokerPlayer(player_i=player_i, initial_chips=10000, pot=pot)
for player_i in range(n_players)
]
return ShortDeckPokerState(players=players, load_pickle_files=False)
pp: PokerPlot = PokerPlot()
And this in a second IPython cell:
state: ShortDeckPokerState = get_state()
pp.update_state(state)
And there was a considerable time-gap in between the execution of the cells!
Woop woop! It's good to know that there's a way to get around this : )
Describe the bug When trying to update the state of PokerPlot using the example provided in applications\visualisation\README.md the following error is returned:
pluribus\games\short_deck\state.py", line 204, in _load_pickle_files f"File path not found {file_path}. Ensure pickle_dir is " ValueError: File path not found ../../research/blueprint_algo/preflop_lossless.pkl. Ensure pickle_dir is set to directory containing pickle files
To Reproduce Steps to reproduce the behavior:
Expected behavior PokerPlot state will be updated
Desktop (please complete the following information):
Additional comments I thought it might be due to Windows using \ to specify the path, but when I used "..\\..\\research\\blueprint_algo\\" path, I also got the same error