open_spiel icon indicating copy to clipboard operation
open_spiel copied to clipboard

Failure for testing MFGs

Open wyz2368 opened this issue 4 years ago • 4 comments

Dear authors,

Does anyone get the following failure information while testing MFGs?

The following tests FAILED:
	143 - python/mfg/algorithms/mirror_descent_test.py (Failed)
	144 - python/mfg/algorithms/greedy_policy_test.py (Failed)
	145 - python/mfg/algorithms/nash_conv_test.py (Failed)
	146 - python/mfg/algorithms/policy_value_test.py (Failed)
	149 - python/mfg/games/dynamic_routing_test.py (Failed)

I found two errors lead to the test failure. (1)

Traceback (most recent call last):
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/games/dynamic_routing_test.py", line 102, in test_online_mirror_descent_convergence
    nash_conv.NashConv(mfg_game, omd.get_policy()).nash_conv(), 0)
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/algorithms/nash_conv.py", line 54, in __init__
    root_state=root_state)
TypeError: __init__() got multiple values for argument 'root_state'

(2)

Traceback (most recent call last):
  File "/opt/anaconda3/envs/spiel_env3/lib/python3.7/site-packages/absl/testing/parameterized.py", line 316, in bound_param_test
    return test_method(self, *testcase_params)
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/algorithms/greedy_policy_test.py", line 53, in test_greedy
    value.TabularValueFunction(game))
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/algorithms/policy_value.py", line 56, in __init__
    self.evaluate()
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/algorithms/policy_value.py", line 102, in evaluate
    self.eval_state(state)
  File "/Users/wangyzh/PycharmProjects/open_spiel/open_spiel/python/mfg/algorithms/policy_value.py", line 60, in eval_state
    state_str = state.observation_string(pyspiel.PlayerId.DEFAULT_PLAYER_ID)
AttributeError: 'TabularValueFunction' object has no attribute 'observation_string'

I also noticed that when test the routing game, a bunch of playthrough information is printed out. For example,

RandomSimTest, game = python_mfg_dynamic_routing, num_sims = 10
Information state vector size: 0
Observation vector size: 28
Utility range: -11 0
Starting new game..
Initial state:
State:
Before initial chance node
player -1
sampled outcome: Vehicle is assigned to population 2. with prob 0.333333
State: 
Location=O->A, waiting_time=2, t=0, destination='D->E'
player 0
Rewards: 0
Returns: 0
Sum Rewards: 0
chose action: 0 (Vehicle 0 reach a sink node or its destination.)
State: 
Location=O->A, waiting_time=1, t=1_mean_field, destination='D->E'
player -5
State: 
Location=O->A, waiting_time=1, t=1, destination='D->E'
player 0
Rewards: 0
Returns: 0
Sum Rewards: 0

Thanks in advance!

wyz2368 avatar Feb 25 '22 06:02 wyz2368

Hi @wyz2368,

Can you explain how you are getting these errors? Is this via a fresh checkout of master and running build_and_run_tests.sh?

Because I don't see how to reproduce it. Several of the PRs have run tests throughout the week and they all passed. So I suspect it's something local to your setup. Did you recently pull from master? I wonder if you have an older setup and if you need to remove some cached files.

lanctot avatar Feb 26 '22 04:02 lanctot

Hi @lanctot, Thank you very much for the information. If PRs succeeded running tests, I think it should be somewhere inconsistent when merging the new repo with my old setup on my side. Thanks again.

I found the printed play-through information during testing may be caused by this line with enabled verbose flag: https://github.com/deepmind/open_spiel/blob/5eaf401f7d08d68285fe214ab5cf5a741807ea6e/open_spiel/python/mfg/games/dynamic_routing_test.py#L197

wyz2368 avatar Feb 26 '22 05:02 wyz2368

Can you try a completely fresh check out from master to see if it happens in that case?

lanctot avatar Feb 26 '22 12:02 lanctot

This issue does not happen with a fresh check. It is my issue. Apologize for the bothering.

wyz2368 avatar Feb 26 '22 18:02 wyz2368