From dfd6accd85cc56babb3ee7c6fac53d7d3cad3a07 Mon Sep 17 00:00:00 2001 From: tslil Date: Thu, 8 Oct 2026 19:51:04 +0100 Subject: switch to orjson for faster loading --- train/src/ctak_train/data.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'train/src/ctak_train') 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 . -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: -- cgit v1.3.1