some quick refactoring

This commit is contained in:
hobogalaxy committed 2020-11-16 20:49:38 +01:00
1 parent 771b854443
commit 03ef46b158
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ https://pytorch.org/get-started/locally/
pip install -r requirements.txt pip install -r requirements.txt
``` ```
### PyCharm set up ### PyCharm setup
- open this repository as PyCharm project - open this repository as PyCharm project
- set "hack_env" as project interpreter:<br> - set "hack_env" as project interpreter:<br>
`Ctrl + Shift + A -> type "Project Interpreter"` `Ctrl + Shift + A -> type "Project Interpreter"`
+2 -2
View File
@@ -18,7 +18,7 @@ class ExampleCallback(Callback):
print('Do something when training ends.') print('Do something when training ends.')
class SaveOnnxToWandbCallback(Callback): class SaveModelOnnxCallback(Callback):
"""Save model in .onnx format.""" """Save model in .onnx format."""
def __init__(self, datamodule, save_dir): def __init__(self, datamodule, save_dir):
first_batch = next(iter(datamodule.train_dataloader())) first_batch = next(iter(datamodule.train_dataloader()))
@@ -55,7 +55,7 @@ class ImagePredictionLoggerCallback(Callback):
]}) ]})
class UnFreezeModelCallback(Callback): class UnfreezeModelCallback(Callback):
"""Unfreeze model after a few epochs.""" """Unfreeze model after a few epochs."""
def __init__(self, wait_epochs=5): def __init__(self, wait_epochs=5):
self.wait_epochs = wait_epochs self.wait_epochs = wait_epochs
+2 -2
View File
@@ -40,8 +40,8 @@ def train(config):
), ),
# ExampleCallback(), # ExampleCallback(),
# ConfusionMatrixLoggerCallback(), # ConfusionMatrixLoggerCallback(),
# UnFreezeModelCallback(wait_epochs=5), # UnfreezeModelCallback(wait_epochs=5),
# SaveOnnxToWandbCallback(datamodule=datamodule, save_dir=wandb_logger.save_dir) # SaveModelOnnxCallback(datamodule=datamodule, save_dir=wandb_logger.save_dir)
] ]
# Init trainer # Init trainer