aikupoker / deeper-stacker

DeeperStacker: DeepHoldem Evil Brother
39 stars 3 forks source link

Feature Request: Start where you left off on Data Generation #3

Closed herrefirh closed 5 years ago

herrefirh commented 5 years ago

I ran the main data generation last night but woke up and it had crashed after 3388 iterations which is like after an hour (.

stack traceback (different computer so I'm summarizing):
./Lookahead/lookahead_builder.lua:537: 1 1
stack traceback:
[C]: in function 'assert'
./Lookahead/lookahead_builder.lua:537: in function '_compute_tree_structures'

Line 537 of lookahead_builder is the assert:

  if layer_actions_count == 2 then
    assert(layer_actions_count == layer_terminal_actions_count, layer_terminal_actions_count .. " " .. current_depth)
    self.lookahead.nonallinbets_count[current_depth] = 0
  end

So I'm not sure why it hit this assert or how to fix it. In any case, ideally code would run in datacenter for few days no problems. But in real life, sometimes we run on home computer, must stop it at times, or maybe electricity goes out or yeah it crashes. Would be nice to have resume feature because when I started up back again it started from 1 erasing old data.

herrefirh commented 5 years ago

Without making any changes, simply rerunning it, I am now to 7327 without a crash, but you never know, it could crash at 20k or 50k

herrefirh commented 5 years ago

Crashed at 11746, I notice in both instances, pot size = 2000 (which is = stack size). I increased max pot on last to 3950 because I still don't understand why to make max pot < 1 person's stack. But it has hundreds, even thousands of situations where pot size is above 2000 no problem. But both times it hit 2000 for first time it crashed.

For now I just move the data to different folder so it's not deleted while I start over

aikupoker commented 5 years ago

Hi @herrefirh

There is no problem to restart data generation because data generation enables you to cancel and start it again.

Data generation format files is the following:

timestamp increases over time so it is impossible to hit the same filename (unless you launch it on the same second and you got the same board in the same batch).

Please, could you share if the error/crash is the same in all data generation? If not, make sure to include here all of them.

Also, I want to know following values:

Actual version commit of your repository:

$ git rev-parse HEAD

List of your NVIDIA graphic card:

nvidia-smi

What street are you generating data? Preflop, Flop, Turn or River.

Thanks!

aikupoker commented 5 years ago

Crashed at 11746, I notice in both instances, pot size = 2000 (which is = stack size). I increased max pot on last to 3950 because I still don't understand why to make max pot < 1 person's stack. But it has hundreds, even thousands of situations where pot size is above 2000 no problem. But both times it hit 2000 for first time it crashed. Now to start over ?(

Hi @herrefirh

By default, each player has a stack of 20,000 chips and not 2,000 chips.

params.stack = 20000
herrefirh commented 5 years ago

Hmm ok, so I will test that next time. Could be I'm mistaken.

Yes the crash looks same to me...(timestamp my own)

[2018-10-21 02:34:35] avgTime: 2.3571827215257    6d7h5s4sTs 3388 2000  
[2018-10-21 02:34:35] /home/computer/torch/install/bin/lua: ./Lookahead/lookahead_builder.lua:537: 1 1
[2018-10-21 02:34:35] stack traceback:
[2018-10-21 02:34:35]   [C]: in function 'assert'
[2018-10-21 02:34:35]   ./Lookahead/lookahead_builder.lua:537: in function '_compute_tree_structures'
[2018-10-21 02:34:35]   ./Lookahead/lookahead_builder.lua:461: in function 'build_from_tree'
[2018-10-21 02:34:35]   ./Lookahead/lookahead.lua:28: in function 'build_lookahead'
[2018-10-21 02:34:35]   ./Lookahead/resolving.lua:54: in function 'resolve_first_node'
[2018-10-21 02:34:35]   ./DataGeneration/data_generation.lua:135: in function 'generate_data_file'
[2018-10-21 02:34:35]   ./DataGeneration/data_generation.lua:24: in function 'generate_data'
[2018-10-21 02:34:35]   DataGeneration/main_data_generation.lua:14: in main chunk
[2018-10-21 02:34:35]   [C]: in function 'dofile'
[2018-10-21 02:34:35]   ...elsa/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[2018-10-21 02:34:35]   [C]: in ?
[2018-10-21 16:24:49] avgTime: 2.3084273727461    6h8sAsKc6s 11746 2000 
[2018-10-21 16:24:49] /home/computer/torch/install/bin/lua: ./Lookahead/lookahead_builder.lua:537: 1 1
[2018-10-21 16:24:49] stack traceback:
[2018-10-21 16:24:49]   [C]: in function 'assert'
[2018-10-21 16:24:49]   ./Lookahead/lookahead_builder.lua:537: in function '_compute_tree_structures'
[2018-10-21 16:24:49]   ./Lookahead/lookahead_builder.lua:461: in function 'build_from_tree'
[2018-10-21 16:24:49]   ./Lookahead/lookahead.lua:28: in function 'build_lookahead'
[2018-10-21 16:24:49]   ./Lookahead/resolving.lua:54: in function 'resolve_first_node'
[2018-10-21 16:24:49]   ./DataGeneration/data_generation.lua:135: in function 'generate_data_file'
[2018-10-21 16:24:49]   ./DataGeneration/data_generation.lua:24: in function 'generate_data'
[2018-10-21 16:24:49]   DataGeneration/main_data_generation.lua:14: in main chunk
[2018-10-21 16:24:49]   [C]: in function 'dofile'
[2018-10-21 16:24:49]   ...elsa/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[2018-10-21 16:24:49]   [C]: in ?

Command I run (river): nohup th DataGeneration/main_data_generation.lua 4 | ts '[%Y-%m-%d %H:%M:%S]' > nohup9.out &

I changed a few of the settings, as you see:

--- the size of the game's ante, in chips
params.ante = 1
params.sb = 5
params.bb = 10
--- the size of each player's stack, in chips
params.stack = 2000
...
if game_settings.nl then
   min_pot = {10,20,40,200,600}
   max_pot = {10,40,200,600,3900}
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130                Driver Version: 384.130                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1070    Off  | 00000000:01:00.0  On |                  N/A |
| 54%   82C    P2   114W / 151W |   1188MiB /  8113MiB |    100%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1093      G   /usr/bin/X                                   164MiB |
|    0      2405      G   ...passed-by-fd --v8-snapshot-passed-by-fd   107MiB |
|    0      4898      C   /home/computer/torch/install/bin/lua         913MiB |
+-----------------------------------------------------------------------------+

I didn't git clone it, I downloaded the master.zip, yesterday, exactly 20 hours ago.

Just so you have some additional color:

[2018-10-21 02:33:58] avgTime: 2.3574740409285    Qh5hKd9hTd 3372 3517  
[2018-10-21 02:33:59] avgTime: 2.3571791764115    9sTdAc9h2s 3373 3334  
[2018-10-21 02:34:01] avgTime: 2.3568833853984    Js4cAdKcKh 3374 359   
[2018-10-21 02:34:02] avgTime: 2.3566646268542    ThTs2cAh4d 3375 78    
[2018-10-21 02:34:06] avgTime: 2.3570038802535    8d8cAd6cQc 3376 163   
[2018-10-21 02:34:08] avgTime: 2.3568635844224    4d4hQs2cKh 3377 53    
[2018-10-21 02:34:10] avgTime: 2.3567967423328    7s6h5c2cJh 3378 480   
[2018-10-21 02:34:13] avgTime: 2.3565738410058    2d5dAdTh7d 3379 10    
[2018-10-21 02:34:15] avgTime: 2.3570820390561    Ac8cTc5dJs 3380 2075  
[2018-10-21 02:34:17] avgTime: 2.3567870851805    Ac8d8s3h3c 3381 1011  
[2018-10-21 02:34:18] avgTime: 2.3564920313293    5cQh4s7d8d 3382 202  
aikupoker commented 5 years ago

Hi @herrefirh

Your last max_pot is not a valid value. In data_generation.lua:

current_node.bets = arguments.Tensor{pot_size, pot_size}

That means that you and your opponent are betting 2,000 (or more). In total: 4,000 chips or more.

It seems that you are generation an action that it is a terminal node (only call or fold) and you are specifying that training data has four actions (call, fold, pot bet and allin). But allin and pot bet is the same action (that's why is failing only when pot size is 2,000).

So, please, consider to change it to:

  if game_settings.nl then
    min_pot = {10, 20, 40, 200, 600}
    max_pot = {10, 40, 200, 600, 1800}

For the next time, make sure that you clone it and keep it updated.

$ git clone https://github.com/aikupoker/deeper-stacker.git
$ git pull origin master
aikupoker commented 5 years ago

It seems that my comment got disappeared.

The problem you got is related with kind of node it is. It is a terminal node (just call or fold) and DeepHoldem thinks that he can do more action (but bet pot is the same option as allin).

If you go to data_generation.lua:

current_node.bets = arguments.Tensor{pot_size, pot_size}

You will see that both players are betting the same, so you can only have in max_pot your stack (less SB or BB). I recommend you to leave it as default:

    min_pot = {100, 200, 400, 2000, 6000}
    max_pot = {100, 400, 2000, 6000, 18000}

Or in your case:

    min_pot = {10, 20, 40, 200, 600}
    max_pot = {10, 40, 200, 600, 1800}

For the next time, it is better to git clone this repository:

$ git clone https://github.com/aikupoker/deeper-stacker.git

And the command to update it:

$ git pull origin master
herrefirh commented 5 years ago

Okie dokie, thanks for the explanation. I guess I wish it was called min/max_bet_size then since I think that better describes what is going on. In any case, now I know.

light3317 commented 5 years ago

@herrefirh Maybe increasing the batch size can reduce the training time? If you hook it up with more powerful gpus