open_spiel icon indicating copy to clipboard operation
open_spiel copied to clipboard

error when using python games with C++ CFR algorithm

Open VitamintK opened this issue 2 years ago • 3 comments

I get an error bad_weak_ptr when I try to use python games with C++ CFR. I'm 99% sure this used to work, but sometime over the past half-year it stopped working.

Tested on both Mac OS and Ubuntu with a fresh install:

>>> import pyspiel
>>> from open_spiel.python.games import kuhn_poker
>>> pyspiel.CFRSolver(kuhn_poker.KuhnPokerGame())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: bad_weak_ptr

>>> pyspiel.CFRSolver(pyspiel.load_game("python_kuhn_poker"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: bad_weak_ptr

VitamintK avatar Aug 10 '22 15:08 VitamintK

Weird... I would have expected this bug to apply to all C++ algorithms, but it looks like pyspiel.exploitability works (as tested in the kuhn_poker_test.py). So it's just the CFR algorithms that break?

VitamintK avatar Aug 10 '22 15:08 VitamintK

Hmm, I am not sure what's going on. I'll look into it. Tagging @elkhrt as I'm sure I will need his help on this.

lanctot avatar Aug 10 '22 20:08 lanctot

Thanks y'all! I also tested pyspiel.CFRBRSolver, pyspiel.OutcomeSamplingMCCFRSolver, and pyspiel.ExternalSamplingMCCFRSolver and confirmed that they give me the same error.

but pyspiel.TabularBestResponse and pyspiel.exploitability seem to work just fine.

VitamintK avatar Aug 10 '22 20:08 VitamintK

Quick update that we are looking into it (and believed we have found the cause ... and by "we" I mean @elkhrt :)). We hope to have a fix out within the next few weeks.

lanctot avatar Aug 19 '22 08:08 lanctot

Thanks @elkhrt!

VitamintK avatar Aug 22 '22 14:08 VitamintK