MCPcopy Create free account
hub / github.com/amazon-science/patchcore-inspection / create_storage_folder

Function create_storage_folder

src/patchcore/utils.py:77–93  ·  view source on GitHub ↗
(
    main_folder_path, project_folder, group_folder, mode="iterate"
)

Source from the content-addressed store, hash-verified

75
76
77def create_storage_folder(
78 main_folder_path, project_folder, group_folder, mode="iterate"
79):
80 os.makedirs(main_folder_path, exist_ok=True)
81 project_path = os.path.join(main_folder_path, project_folder)
82 os.makedirs(project_path, exist_ok=True)
83 save_path = os.path.join(project_path, group_folder)
84 if mode == "iterate":
85 counter = 0
86 while os.path.exists(save_path):
87 save_path = os.path.join(project_path, group_folder + "_" + str(counter))
88 counter += 1
89 os.makedirs(save_path)
90 elif mode == "overwrite":
91 os.makedirs(save_path, exist_ok=True)
92
93 return save_path
94
95
96def set_torch_device(gpu_ids):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected