feat: enhance nnue.py and train.py with options for existing labels and improved file handling
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user