def __init__(self, project_name="deeplodocus_project", main_path: Optional[str] = None, force_overwrite: bool = False): """ AUTHORS: -------- :author: Alix Leroy :author: Samuel Westlake DESCRIPTION: ------------ Initialize a instance ready to create a new Deeplodocus project PARAMETERS: ----------- :param project_name(str, optional): The name of the project :param main_path(str, optional): The path of the working directory :param force_overwrite(bool, optional): Whether we want to overwrite an existing project or not RETURN: ------- None """ self.project_name = project_name self.force_overwrite = force_overwrite if main_path is None: self.main_path = get_main_path() else: self.main_path = main_path
def __add_log(message: str) -> None: """ AUTHORS: -------- :author: Alix Leroy :author: Samuel Westlake DESCRIPTION: ------------ Add a message to the logs. PARAMETERS: ----------- :param message (str): The message to save in the logs. RETURN: ------- :return: None """ Logs(log_type=DEEP_LOG_NOTIFICATION, directory=get_main_path(), extension=DEEP_EXT_LOGS).add(message)
import deeplodocus.app.metrics as deep_metrics import deeplodocus.data.load as deep_sources import torchvision.datasets as tv_data DEEP_MODULE_OPTIMIZERS = { "pytorch": { "path": torch.optim.__path__, "prefix": torch.optim.__name__ }, "deeplodocus": { "path": deep_optim.__path__, "prefix": deep_optim.__name__ }, "custom": { "path": [get_main_path() + "/modules/optimizers"], "prefix": "modules.optimizers" } } DEEP_MODULE_SOURCES = { "deeplodocus": { "path": deep_sources.__path__, "prefix": deep_sources.__name__ }, "custom": { "path": ["%s/modules/sources" % get_main_path()], "prefix": "modules.sources" } }
from deeplodocus.flags.ext import DEEP_EXT_CSV, DEEP_EXT_LOGS from deeplodocus.utils import get_main_path DEEP_LOG_NOTIFICATION = "notification" DEEP_LOG_HISTORY_TRAIN_BATCHES = "history_train_batches" DEEP_LOG_HISTORY_TRAIN_EPOCHS = "history_train_epochs" DEEP_LOG_HISTORY_VALIDATION = "history_validation" DEEP_LOGS = { DEEP_LOG_NOTIFICATION: [get_main_path(), DEEP_EXT_LOGS], DEEP_LOG_HISTORY_TRAIN_BATCHES: [get_main_path(), DEEP_EXT_CSV], DEEP_LOG_HISTORY_TRAIN_EPOCHS: [get_main_path(), DEEP_EXT_CSV], DEEP_LOG_HISTORY_VALIDATION: [get_main_path(), DEEP_EXT_CSV] } DEEP_LOG_RESULT_DIRECTORIES = ["logs", "weights", "history"]
from deeplodocus.utils import get_main_path DEEP_PATH_NOTIFICATION = r"%s/logs" % get_main_path() DEEP_PATH_HISTORY = r"%s/results/history" % get_main_path() DEEP_PATH_SAVE_MODEL = r"%s/results/models" % get_main_path()
from deeplodocus.utils import get_main_path from deeplodocus.utils.flag import Flag # # ENTRIES # DEEP_ENTRY_INPUT = 0 DEEP_ENTRY_LABEL = 1 DEEP_ENTRY_OUTPUT = 2 DEEP_ENTRY_ADDITIONAL_DATA = 3 DEEP_ENTRY_INPUT = Flag(name="Input", description="Input entry", names=["input", "inputs", "inp", "x"]) DEEP_ENTRY_LABEL = Flag(name="Label", description="Label entry", names=[ "label", "labels", "lab", "expected output", "expected_output", "y_expected", "y_hat" ]) DEEP_ENTRY_OUTPUT = Flag(name="Output", description="Output entry", names=["output", "outputs", "y"]) DEEP_ENTRY_ADDITIONAL_DATA = Flag(name="Additional data", description="Additional Data entry", names=["additional_data", "additional data"]) DEEP_ENTRY_BASE_FILE_NAME = get_main_path( ) + "/data/auto-generated_dataset_%s_entry_%s_%i_source_%i.dat"
import torch import torch.nn.functional from deeplodocus.utils import get_main_path import deeplodocus.data.transforms as tfm DEEP_MODULE_OPTIMIZERS = { "pytorch": { "path": torch.optim.__path__, "prefix": torch.optim.__name__ }, "custom": { "path": [get_main_path() + "/modules/optimizers"], "prefix": "modules.optimizers" } } DEEP_MODULE_MODELS = { "custom": { "path": [get_main_path() + "/modules/models"], "prefix": "modules.models" } } DEEP_MODULE_LOSSES = { "pytorch": { "path": torch.nn.__path__, "prefix": torch.nn.__name__ }, "custom": { "path": [get_main_path() + "/modules/losses"],
# DEEP_ENTRY_INPUT = 0 DEEP_ENTRY_LABEL = 1 DEEP_ENTRY_OUTPUT = 2 DEEP_ENTRY_ADDITIONAL_DATA = 3 DEEP_ENTRY_INPUT = Flag( name="Input", description="Input entry", names=["input", "inputs", "inp", "x"] ) DEEP_ENTRY_LABEL = Flag( name="Label", description="Label entry", names=["label", "labels", "lab", "expected output", "expected_output", "y_expected", "y_hat"] ) DEEP_ENTRY_OUTPUT = Flag( name="Output", description="Output entry", names=["output", "outputs", "y"] ) DEEP_ENTRY_ADDITIONAL_DATA = Flag( name="Additional data", description="Additional Data entry", names=["additional_data", "additional data"] ) DEEP_ENTRY_BASE_FILE_NAME = get_main_path() + "/data/auto-generated_dataset_source_folder_%i.dat"