feat: enhance nnue.py and train.py with options for existing labels and improved file handling

This commit is contained in:
2026-04-08 09:16:02 +02:00
committed by Janis
parent adc2de23bc
commit 34945e4fb8
2 changed files with 34 additions and 18 deletions
+6 -2
View File
@@ -92,10 +92,14 @@ def find_next_version(base_name="nnue_weights"):
Looks for nnue_weights_v*.pt files and returns the next version number.
If no versioned files exist, returns 1.
"""
pattern = re.compile(rf"{re.escape(base_name)}_v(\d+)\.pt")
base_path = Path(base_name)
directory = base_path.parent
filename = base_path.name
pattern = re.compile(rf"{re.escape(filename)}_v(\d+)\.pt")
versions = []
for file in Path(".").glob(f"{base_name}_v*.pt"):
for file in directory.glob(f"{filename}_v*.pt"):
match = pattern.match(file.name)
if match:
versions.append(int(match.group(1)))