Skip to content

Commit d00d1b6

Browse files
committed
Remove redundant code + Colab notebook tweaks
1 parent 788903e commit d00d1b6

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

napari_cellseg3d/dev_scripts/colab_training.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@
3030
VERBOSE_SCHEDULER = True
3131
logger.debug(f"PRETRAINED WEIGHT DIR LOCATION : {PRETRAINED_WEIGHTS_DIR}")
3232

33-
try:
34-
import wandb
35-
36-
WANDB_INSTALLED = True
37-
except ImportError:
38-
logger.warning(
39-
"wandb not installed, wandb config will not be taken into account",
40-
stacklevel=1,
41-
)
42-
WANDB_INSTALLED = False
43-
4433

4534
class LogFixture:
4635
"""Fixture for napari-less logging, replaces napari_cellseg3d.interface.Log in model_workers.
@@ -161,8 +150,7 @@ def get_colab_worker(
161150
wandb_config (config.WandBConfig): config for wandb
162151
"""
163152
log = LogFixture()
164-
worker = WNetTrainingWorkerColab(worker_config)
165-
worker.wandb_config = wandb_config
153+
worker = WNetTrainingWorkerColab(worker_config, wandb_config)
166154

167155
worker.log_signal.connect(log.print_and_log)
168156
worker.warn_signal.connect(log.warn)

notebooks/Colab_WNet3D_training.ipynb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@
313313
"outputs": [],
314314
"source": [
315315
"#@markdown ###Path to the training data:\n",
316-
"training_source = \"./gdrive/MyDrive/CELLSEG_BENCHMARK/DATA/WNET/VIP_full\" #@param {type:\"string\"}\n",
317-
"#@markdown ###Model name and path to model folder:\n",
318-
"model_save_path = \"./gdrive/MyDrive/CELLSEG_BENCHMARK/WNET_TRAINING_RESULTS\" #@param {type:\"string\"}\n",
316+
"training_source = \"./gdrive/MyDrive/path/to/data\" #@param {type:\"string\"}\n",
317+
"#@markdown ###Path to save the weights (make sure to have enough space in your drive):\n",
318+
"model_save_path = \"./gdrive/MyDrive/WNET_TRAINING_RESULTS\" #@param {type:\"string\"}\n",
319319
"#@markdown ---\n",
320-
"#@markdown ###Perform validation on a test dataset\n",
320+
"#@markdown ###Perform validation on a test dataset (optional):\n",
321321
"do_validation = False #@param {type:\"boolean\"}\n",
322322
"#@markdown ###Path to evaluation data (optional, use if checked above):\n",
323323
"eval_source = \"./gdrive/MyDrive/CELLSEG_BENCHMARK/DATA/WNET/eval/vol/\" #@param {type:\"string\"}\n",
@@ -396,13 +396,6 @@
396396
" eval_label_folder,\n",
397397
" ) if do_validation else None\n",
398398
"\n",
399-
"try:\n",
400-
" import wandb\n",
401-
" WANDB_INSTALLED = True\n",
402-
"except ImportError:\n",
403-
" WANDB_INSTALLED = False\n",
404-
"\n",
405-
"\n",
406399
"train_config = WNetTrainingWorkerConfig(\n",
407400
" device=\"cuda:0\",\n",
408401
" max_epochs=number_of_epochs,\n",

0 commit comments

Comments
 (0)