training wip

This commit is contained in:
Dobromir Popov
2025-07-13 11:29:01 +03:00
parent 2d8f763eeb
commit bcc13a5db3
5 changed files with 543 additions and 291 deletions

View File

@ -5,7 +5,7 @@ import numpy as np
from collections import deque
import random
from typing import Tuple, List
import osvu
import os
import sys
import logging
import torch.nn.functional as F
@ -216,12 +216,12 @@ class DQNAgent:
self.tick_feature_weight = 0.3 # Weight for tick features in decision making
# Check if mixed precision training should be used
self.use_mixed_precision = False
if torch.cuda.is_available() and hasattr(torch.cuda, 'amp') and 'DISABLE_MIXED_PRECISION' not in os.environ:
self.use_mixed_precision = True
self.scaler = torch.cuda.amp.GradScaler()
logger.info("Mixed precision training enabled")
else:
self.use_mixed_precision = False
logger.info("Mixed precision training disabled")
# Track if we're in training mode
@ -405,12 +405,12 @@ class DQNAgent:
self.tick_feature_weight = 0.3 # Weight for tick features in decision making
# Check if mixed precision training should be used
self.use_mixed_precision = False
if torch.cuda.is_available() and hasattr(torch.cuda, 'amp') and 'DISABLE_MIXED_PRECISION' not in os.environ:
self.use_mixed_precision = True
self.scaler = torch.cuda.amp.GradScaler()
logger.info("Mixed precision training enabled")
else:
self.use_mixed_precision = False
logger.info("Mixed precision training disabled")
# Track if we're in training mode