Skip to content

Commit

Permalink
fix mini_batch_size being referenced before assignment (#25) (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipkd committed Jan 23, 2024
1 parent 2d5c21a commit 7055122
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weak_to_strong/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ def maybe_load_model(model):
).to("cuda")
already_trained = maybe_load_model(model)
# data parallel: currently not supported with model parallel

minibatch_size = min(minibatch_size_per_device * torch.cuda.device_count(), batch_size)

if torch.cuda.device_count() > 1:
model = torch.nn.DataParallel(model, output_device=0)
minibatch_size = min(minibatch_size_per_device * torch.cuda.device_count(), batch_size)
print(
"Using",
torch.cuda.device_count(),
Expand Down

0 comments on commit 7055122

Please sign in to comment.