9 files changed
+49
-55
No files matched your search
@@ -46,11 +46,6 @@ The directory structure of new project looks like this:
|
|||||||
│ │
|
│ │
|
||||||
│ ├── notebooks <- Jupyter notebooks
|
│ ├── notebooks <- Jupyter notebooks
|
||||||
│ │
|
│ │
|
||||||
│ ├── template_utils <- Different project utilities
|
|
||||||
│ │ ├── execute_sweep.py <- Special file for executing Weights&Biases sweeps
|
|
||||||
│ │ ├── inference_example.py <- Example of inference with trained model
|
|
||||||
│ │ └── initializers.py <- Initializers for different modules
|
|
||||||
│ │
|
|
||||||
│ ├── src
|
│ ├── src
|
||||||
│ │ ├── architectures <- PyTorch model architectures
|
│ │ ├── architectures <- PyTorch model architectures
|
||||||
│ │ ├── callbacks <- PyTorch Lightning callbacks
|
│ │ ├── callbacks <- PyTorch Lightning callbacks
|
||||||
@@ -59,6 +54,8 @@ The directory structure of new project looks like this:
|
|||||||
│ │ ├── models <- PyTorch Lightning models
|
│ │ ├── models <- PyTorch Lightning models
|
||||||
│ │ ├── transforms <- Data transformations
|
│ │ ├── transforms <- Data transformations
|
||||||
│ │ └── utils <- Utility scripts
|
│ │ └── utils <- Utility scripts
|
||||||
|
│ │ ├── inference_example.py <- Example of inference with trained model
|
||||||
|
│ │ └── initializers.py <- Initializers for different modules
|
||||||
│ │
|
│ │
|
||||||
│ └── train.py <- Train model with chosen run configuration
|
│ └── train.py <- Train model with chosen run configuration
|
||||||
│
|
│
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from pytorch_lightning.metrics.classification import Accuracy
|
from pytorch_lightning.metrics.classification import Accuracy
|
||||||
from template_utils.initializers import load_class
|
from src.utils.initializers import load_class
|
||||||
import pytorch_lightning as pl
|
import pytorch_lightning as pl
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
import torch
|
import torch
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# # THIS FILE IS FOR HYPERPARAMETER SEARCH WITH Weights&Biases
|
||||||
|
# # IT SHOULDN't BE EXECUTED DIRECTLY, IT SHOULD BE RUN BY WANDB SWEEP AGENT!
|
||||||
|
#
|
||||||
|
# # hydra imports
|
||||||
|
# from omegaconf import DictConfig
|
||||||
|
# import hydra
|
||||||
|
#
|
||||||
|
# # template utils imports
|
||||||
|
# import src.utils.initializers as utils
|
||||||
|
#
|
||||||
|
# import wandb
|
||||||
|
# from train import train
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # Replace run config hyperparameters with the ones loaded from wandb sweep server
|
||||||
|
# def replace_hparams(config, sweep_hparams):
|
||||||
|
# for key, value in sweep_hparams.items():
|
||||||
|
# if key == "_wandb":
|
||||||
|
# continue
|
||||||
|
# elif key in config["trainer"]["args"]:
|
||||||
|
# config["trainer"]["args"][key] = value
|
||||||
|
# elif key in config["model"]["args"]:
|
||||||
|
# config["model"]["args"][key] = value
|
||||||
|
# elif key in config["optimizer"]["args"]:
|
||||||
|
# config["optimizer"]["args"][key] = value
|
||||||
|
# elif key in config["datamodule"]["args"]:
|
||||||
|
# config["datamodule"]["args"][key] = value
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# @hydra.main(config_path="configs/", config_name="config.yaml")
|
||||||
|
# def main(config: DictConfig) -> None:
|
||||||
|
# wandb.init()
|
||||||
|
#
|
||||||
|
# sweep_hparams = wandb.Config._as_dict(wandb.config)
|
||||||
|
# utils.show_config(config) # print content of config
|
||||||
|
#
|
||||||
|
# train(config)
|
||||||
|
# wandb.finish()
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
# main()
|
||||||
File renamed without changes.
File renamed without changes.
@@ -1,42 +0,0 @@
|
|||||||
# THIS FILE IS FOR HYPERPARAMETER SEARCH WITH Weights&Biases
|
|
||||||
# IT SHOULDN't BE EXECUTED DIRECTLY, IT SHOULD BE RUN BY WANDB SWEEP AGENT!
|
|
||||||
|
|
||||||
# hydra imports
|
|
||||||
from omegaconf import DictConfig
|
|
||||||
import hydra
|
|
||||||
|
|
||||||
# template utils imports
|
|
||||||
import template_utils.initializers as utils
|
|
||||||
|
|
||||||
import wandb
|
|
||||||
from train import train
|
|
||||||
|
|
||||||
|
|
||||||
# Replace run config hyperparameters with the ones loaded from wandb sweep server
|
|
||||||
def replace_hparams(config, sweep_hparams):
|
|
||||||
for key, value in sweep_hparams.items():
|
|
||||||
if key == "_wandb":
|
|
||||||
continue
|
|
||||||
elif key in config["trainer"]["args"]:
|
|
||||||
config["trainer"]["args"][key] = value
|
|
||||||
elif key in config["model"]["args"]:
|
|
||||||
config["model"]["args"][key] = value
|
|
||||||
elif key in config["optimizer"]["args"]:
|
|
||||||
config["optimizer"]["args"][key] = value
|
|
||||||
elif key in config["datamodule"]["args"]:
|
|
||||||
config["datamodule"]["args"][key] = value
|
|
||||||
|
|
||||||
|
|
||||||
@hydra.main(config_path="configs/", config_name="config.yaml")
|
|
||||||
def main(config: DictConfig) -> None:
|
|
||||||
wandb.init()
|
|
||||||
|
|
||||||
sweep_hparams = wandb.Config._as_dict(wandb.config)
|
|
||||||
utils.show_config(config) # print content of config
|
|
||||||
|
|
||||||
train(config)
|
|
||||||
wandb.finish()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
import hydra
|
|
||||||
+1
-3
@@ -12,12 +12,10 @@ from typing import List
|
|||||||
import wandb
|
import wandb
|
||||||
|
|
||||||
# template utils imports
|
# template utils imports
|
||||||
import template_utils.initializers as utils
|
import src.utils.initializers as utils
|
||||||
|
|
||||||
|
|
||||||
def train(config):
|
def train(config):
|
||||||
# Validate the correctness of loaded config
|
|
||||||
utils.validate_config(config=config)
|
|
||||||
|
|
||||||
# Set global PyTorch seed
|
# Set global PyTorch seed
|
||||||
if "seeds" in config and "pytorch_seed" in config["seeds"]:
|
if "seeds" in config and "pytorch_seed" in config["seeds"]:
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@ torch>=1.7.0
|
|||||||
torchvision>=0.8.1
|
torchvision>=0.8.1
|
||||||
torchaudio>=0.7.0
|
torchaudio>=0.7.0
|
||||||
pytorch-lightning>=1.1.3
|
pytorch-lightning>=1.1.3
|
||||||
hydra-core
|
hydra-core>=1.0.5
|
||||||
wandb>=0.10.12
|
wandb>=0.10.13
|
||||||
scikit-learn>=0.23.2
|
scikit-learn>=0.23.2
|
||||||
pandas>=1.1.5
|
pandas>=1.1.5
|
||||||
hydra_colorlog
|
hydra_colorlog>=1.0.0
|
||||||
Reference in new issue
Block a user