- Create python directory with data/, model/ subdirectories - Implement LinearEval(61072->1) model - Add config, constants, feature_extractor - Add tests with 4 passing test cases
40 lines
1006 B
Python
40 lines
1006 B
Python
"""Main entry point for training"""
|
|
|
|
import numpy as np
|
|
from python.model.nnue_linear import LinearEval
|
|
from python.data.generate_data import generate_data_from_pgn
|
|
from python.data.preprocessing import normalize_features
|
|
from python.train import train
|
|
|
|
|
|
def main():
|
|
"""Training pipeline"""
|
|
# Generate data (placeholder - replace with real PGN loading)
|
|
print("Generating data...")
|
|
features, evals = generate_data_from_pgn(
|
|
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
|
|
)
|
|
|
|
# Normalize
|
|
print("Normalizing features...")
|
|
features = np.array(features, dtype=np.float32)
|
|
evals = np.array(evals, dtype=np.float32)
|
|
features = normalize_features(features)
|
|
|
|
# Train
|
|
print("Training...")
|
|
model = train(features, evals)
|
|
|
|
# Test
|
|
print("Testing...")
|
|
x = torch.randn(1, 61072)
|
|
with torch.no_grad():
|
|
pred = model(x)
|
|
print(f"Sample prediction: {pred.item():.4f}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import torch
|
|
|
|
main()
|