debug: 固定验证集上的随机噪声,修复resnet在训练时bn层会切换到train的问题
This commit is contained in:
@@ -200,6 +200,13 @@ def main(cfg: DictConfig):
|
||||
if val_loader is None:
|
||||
return None
|
||||
agent.eval()
|
||||
|
||||
# 🔧 FIX: Set deterministic seed for validation to get reproducible loss
|
||||
# This ensures validation loss is comparable across different steps
|
||||
torch.manual_seed(42)
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.manual_seed(42)
|
||||
|
||||
total_loss = 0.0
|
||||
num_batches = 0
|
||||
with torch.no_grad():
|
||||
|
||||
Reference in New Issue
Block a user