diff options
| author | tslil <tslil@posteo.de> | 2026-10-08 19:51:04 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-10-09 20:29:37 +0100 |
| commit | dfd6accd85cc56babb3ee7c6fac53d7d3cad3a07 (patch) | |
| tree | 67bea2810f8c1c658315b1feb5d880dc20a24d1c /train/src/ctak_train/data.py | |
| parent | adf8dee63cf3a2b2fea7c74daf90f7efbe1e9017 (diff) | |
switch to orjson for faster loadinghybrid_rootstrap
Diffstat (limited to 'train/src/ctak_train/data.py')
| -rw-r--r-- | train/src/ctak_train/data.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/train/src/ctak_train/data.py b/train/src/ctak_train/data.py index 6dc9ec0..8d21bbe 100644 --- a/train/src/ctak_train/data.py +++ b/train/src/ctak_train/data.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with ctak. If not, see <https://www.gnu.org/licenses/>. -import json +import orjson from collections.abc import Iterator from dataclasses import dataclass from pathlib import Path @@ -168,11 +168,11 @@ def load_window( for file_index, path in enumerate(files): is_newest = file_index == len(files) - 1 - with open(path) as f: + with open(path, "rb") as f: for line in f: if not line.strip(): continue - game = json.loads(line) + game = orjson.loads(line) game_result = float(game["result"]) self_play = int(game["cand_A"]) == int(game["cand_B"]) if is_newest: |
