From ebf8a63b73f076d432bee0a4936544429ea0e7c8 Mon Sep 17 00:00:00 2001 From: buehlmar Date: Sun, 3 Mar 2024 12:30:15 +0100 Subject: [PATCH] Remove try block when importing modules --- varitex/demo.py | 28 ++++++++++++++-------------- varitex/train.py | 17 +++++------------ 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/varitex/demo.py b/varitex/demo.py index 0b988f5..4a922d3 100644 --- a/varitex/demo.py +++ b/varitex/demo.py @@ -1,20 +1,20 @@ import imageio import torch -try: - from mutil.object_dict import ObjectDict - from varitex.data.keys_enum import DataItemKey as DIK - from varitex.data.uv_factory import BFMUVFactory - from varitex.modules.pipeline import PipelineModule - from varitex.visualization.batch import CompleteVisualizer - from varitex.options import varitex_default_options -except ModuleNotFoundError as e: - print(e) - print("Have you added VariTex to your pythonpath?") - print('To fix this error, go to the root path of the repository ".../VariTex/" \n ' - 'and run \n' - "export PYTHONPATH=$PYTHONPATH:$(pwd)") - exit() +# try: +from mutil.object_dict import ObjectDict +from varitex.data.keys_enum import DataItemKey as DIK +from varitex.data.uv_factory import BFMUVFactory +from varitex.modules.pipeline import PipelineModule +from varitex.visualization.batch import CompleteVisualizer +from varitex.options import varitex_default_options +# except ModuleNotFoundError as e: +# print(e) +# print("Have you added VariTex to your pythonpath?") +# print('To fix this error, go to the root path of the repository ".../VariTex/" \n ' +# 'and run \n' +# "export PYTHONPATH=$PYTHONPATH:$(pwd)") +# exit() class Demo: diff --git a/varitex/train.py b/varitex/train.py index 2d65b19..6b94d71 100644 --- a/varitex/train.py +++ b/varitex/train.py @@ -8,18 +8,11 @@ from pytorch_lightning.loggers import WandbLogger, TensorBoardLogger from torch.utils.data import DataLoader -try: - from varitex.custom_callbacks.callbacks import ImageLogCallback - from varitex.data.npy_dataset import NPYDataset - from varitex.modules.pipeline import PipelineModule - from varitex.options.train_options import TrainOptions - from mutil.files import copy_src, mkdir -except ModuleNotFoundError: - print("Have you added VariTex to your pythonpath?") - print('To fix this error, go to the root path of the repository ".../VariTex/" \n ' - 'and run \n' - "export PYTHONPATH=$PYTHONPATH:$(pwd)") - exit() +from varitex.custom_callbacks.callbacks import ImageLogCallback +from varitex.data.npy_dataset import NPYDataset +from varitex.modules.pipeline import PipelineModule +from varitex.options.train_options import TrainOptions +from mutil.files import copy_src, mkdir if __name__ == "__main__":