try to work with ROCKm (AMD) GPUs again

This commit is contained in:
Dobromir Popov
2025-11-12 18:12:47 +02:00
parent 8354aec830
commit 4a5c3fc943
6 changed files with 16 additions and 10 deletions

View File

@@ -536,7 +536,8 @@ class RealtimeRLCOBTrader:
features_tensor = torch.from_numpy(features).unsqueeze(0).to(self.device)
with torch.no_grad():
with torch.amp.autocast('cuda'):
device_type = 'cuda' if self.device.type == 'cuda' else 'cpu'
with torch.amp.autocast(device_type, enabled=device_type != 'cpu'):
outputs = model(features_tensor)
# Extract predictions
@@ -934,7 +935,8 @@ class RealtimeRLCOBTrader:
], dtype=torch.float32).to(self.device)
# Forward pass with mixed precision
with torch.amp.autocast('cuda'):
device_type = 'cuda' if self.device.type == 'cuda' else 'cpu'
with torch.amp.autocast(device_type, enabled=device_type != 'cpu'):
outputs = model(features)
# Calculate losses