Data Worker for collecting data through self-play Parameters ---------- rank: int id of the worker replay_buffer: Any Replay buffer storage: Any The model storage
(self, rank, replay_buffer, storage, config)
| 15 | @ray.remote(num_gpus=0.125) |
| 16 | class DataWorker(object): |
| 17 | def __init__(self, rank, replay_buffer, storage, config): |
| 18 | """Data Worker for collecting data through self-play |
| 19 | Parameters |
| 20 | ---------- |
| 21 | rank: int |
| 22 | id of the worker |
| 23 | replay_buffer: Any |
| 24 | Replay buffer |
| 25 | storage: Any |
| 26 | The model storage |
| 27 | """ |
| 28 | self.rank = rank |
| 29 | self.config = config |
| 30 | self.storage = storage |
| 31 | self.replay_buffer = replay_buffer |
| 32 | # double buffering when data is sufficient |
| 33 | self.trajectory_pool = [] |
| 34 | self.pool_size = 1 |
| 35 | self.device = self.config.device |
| 36 | self.gap_step = self.config.num_unroll_steps + self.config.td_steps |
| 37 | self.last_model_index = -1 |
| 38 | |
| 39 | def put(self, data): |
| 40 | # put a game history into the pool |
nothing calls this directly
no outgoing calls
no test coverage detected