-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
47 lines (38 loc) · 1.53 KB
/
setup.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
import os
from datetime import datetime
def create_project_structure(base_dir: str="./") -> None:
dirs = [
f"{base_dir}/src",
f"{base_dir}/src/utils",
f"{base_dir}/src/models",
f"{base_dir}/src/datasets",
f"{base_dir}/data",
f"{base_dir}/configs",
f"{base_dir}/outputs",
f"{base_dir}/wandb",
f"{base_dir}/etc",
f"{base_dir}/etc/streamlit",
f"{base_dir}/etc/EDA",
f"{base_dir}/etc/visualization"
]
# Create directories
for dir in dirs:
os.makedirs(dir, exist_ok=True)
# Create main.py and configuration files in the base directory
open(f"{base_dir}/main.py", 'a').close()
for config_file in ["base.yaml", "path.yaml", "train.yaml"]:
open(f"{base_dir}/configs/{config_file}", 'a').close()
# Create source files in src
for src_file in ["train.py", "inference.py"]:
open(f"{base_dir}/src/{src_file}", 'a').close()
# Create utility files in src/utils
for util_file in ["metrics.py", "trainer.py", "wandb_logger.py"]:
open(f"{base_dir}/src/utils/{util_file}", 'a').close()
# Create model utility file in src/models
open(f"{base_dir}/src/models/model_utils.py", 'a').close()
# Create dataset files in src/datasets
for dataset_file in ["dataset.py", "dataloader.py"]:
open(f"{base_dir}/src/datasets/{dataset_file}", 'a').close()
print("Directory structure created.")
# Run the function to create the directory structure
create_project_structure()