Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion icu_benchmarks/models/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ def train_common(
model.set_weight(weight, train_dataset)
model.set_trained_columns(train_dataset.get_feature_names())
loggers = [TensorBoardLogger(log_dir), JSONMetricsLogger(log_dir)]
devices = max(torch.cuda.device_count(), 1)

if use_wandb:
loggers.append(WandbLogger(save_dir=log_dir))
logging.info("Use of wandb is detected. Only single gpu training is supported with wandb.")
devices = 1

callbacks = [
EarlyStopping(monitor="val/loss", min_delta=min_delta, patience=patience, strict=False, verbose=verbose),
ModelCheckpoint(log_dir, filename="model", save_top_k=1, save_last=True),
Expand All @@ -158,7 +163,7 @@ def train_common(
callbacks=callbacks,
precision=precision,
accelerator="auto" if not cpu else "cpu",
devices=max(torch.cuda.device_count(), 1),
devices=devices,
deterministic="warn" if reproducible else False,
benchmark=not reproducible,
enable_progress_bar=verbose,
Expand Down