MCPcopy
hub / github.com/visomaster/VisoMaster / load_model

Method load_model

app/processors/models_processor.py:125–143  ·  view source on GitHub ↗
(self, model_name, session_options=None)

Source from the content-addressed store, hash-verified

123 self.lp_lip_array = self.face_editors.lp_lip_array
124
125 def load_model(self, model_name, session_options=None):
126 with self.model_lock:
127 self.main_window.model_loading_signal.emit()
128 # QApplication.processEvents()
129 # if not is_file_exists(self.models_path[model_name]):
130 # download_file(model_name, self.models_path[model_name], self.models_data[model_name]['hash'], self.models_data[model_name]['url'])
131 if session_options is None:
132 model_instance = onnxruntime.InferenceSession(self.models_path[model_name], providers=self.providers)
133 else:
134 model_instance = onnxruntime.InferenceSession(self.models_path[model_name], sess_options=session_options, providers=self.providers)
135
136 # Check if another thread has already loaded an instance for this model, if yes then delete the current one and return that instead
137 if self.models[model_name]:
138 del model_instance
139 gc.collect()
140 return self.models[model_name]
141 self.main_window.model_loaded_signal.emit()
142
143 return model_instance
144
145 def load_dfm_model(self, dfm_model):
146 with self.model_lock:

Callers 15

run_GFPGANMethod · 0.80
run_GPEN_256Method · 0.80
run_GPEN_512Method · 0.80
run_GPEN_1024Method · 0.80
run_GPEN_2048Method · 0.80
run_codeformerMethod · 0.80
run_VQFR_v2Method · 0.80
lp_motion_extractorMethod · 0.80
lp_retarget_eyeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected