Skip to content

Commit

Permalink
feat: ⚡️ Don't run validation in parallel if you don't distribute wor…
Browse files Browse the repository at this point in the history
…kers
  • Loading branch information
rhoadesScholar committed May 29, 2024
1 parent 3c7e309 commit a3a8f1e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions dacapo/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,19 @@ def train_run(run: Run):
weights_store.store_weights(run, iteration_stats.iteration + 1)
try:
# launch validation in a separate thread to avoid blocking training
validate_thread = threading.Thread(
target=validate,
args=(run, iteration_stats.iteration + 1),
name=f"validate_{run.name}_{iteration_stats.iteration + 1}",
daemon=True,
)
validate_thread.start()
# validate(
# run,
# iteration_stats.iteration + 1,
# )
if compute_context.distribute_workers:
validate_thread = threading.Thread(
target=validate,
args=(run, iteration_stats.iteration + 1),
name=f"validate_{run.name}_{iteration_stats.iteration + 1}",
daemon=True,
)
validate_thread.start()
else:
validate(
run,
iteration_stats.iteration + 1,
)

stats_store.store_validation_iteration_scores(
run.name, run.validation_scores
Expand Down

0 comments on commit a3a8f1e

Please sign in to comment.