-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
60 lines (50 loc) · 1.82 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from dotenv import load_dotenv
from DeepfakeDetection import logger
from DeepfakeDetection.pipeline.stage_01_data_ingestion import DataIngestionPipeline
from DeepfakeDetection.pipeline.stage_02_data_preprocessing import (
DataPreprocessingPipeline,
)
from DeepfakeDetection.pipeline.stage_03_model_training import ModelTrainingPipeline
from DeepfakeDetection.pipeline.stage_04_model_evaluation import ModelEvaluationPipeline
# load the env variables for the mlflow tracking
load_dotenv()
# Data Ingestion stage
STAGE_NAME = "Data Ingestion stage"
try:
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} started <<<<<<\n\n")
data_ingestion = DataIngestionPipeline()
data_ingestion.main()
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} completed <<<<<<\n\n")
except Exception as e:
logger.exception(e)
raise e
# Data Preprocessing stage
STAGE_NAME = "Data Preprocessing"
try:
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} started <<<<<<\n\n")
data_preprocessing = DataPreprocessingPipeline()
data_preprocessing.main()
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} completed <<<<<<\n\n")
except Exception as e:
logger.exception(e)
raise e
# Model Training stage
STAGE_NAME = "Model Training stage"
try:
logger.info(f"\n\n >>>>>> stage {STAGE_NAME} started <<<<<<\n\n")
obj = ModelTrainingPipeline()
obj.main()
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} completed <<<<<<\n\n")
except Exception as e:
logger.exception(e)
raise e
# Model Evaluation stage
STAGE_NAME = "Model Evaluation stage"
try:
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} started <<<<<<\n\n")
model_evaluation_pipeline = ModelEvaluationPipeline()
model_evaluation_pipeline.main()
logger.info(f"\n\n>>>>>> stage {STAGE_NAME} completed <<<<<<\n\n")
except Exception as e:
logger.exception(e)
raise e