MCPcopy Index your code
hub / github.com/NVIDIA/Stable-Diffusion-WebUI-TensorRT / process

Method process

scripts/trt.py:242–265  ·  view source on GitHub ↗
(self, p, *args)

Source from the content-addressed store, hash-verified

240 self.lora_refit_dict = refit_dict
241
242 def process(self, p, *args):
243 # before unet_init
244 sd_unet_option = sd_unet.get_unet_option()
245 if sd_unet_option is None:
246 return
247
248 if not sd_unet_option.model_name == p.sd_model_name:
249 gr.Error(
250 """Selected torch model ({}) does not match the selected TensorRT U-Net ({}).
251 Please ensure that both models are the same or select Automatic from the SD UNet dropdown.""".format(
252 p.sd_model_name, sd_unet_option.model_name
253 )
254 )
255 self.idx, self.hr_idx = self.get_profile_idx(p, p.sd_model_name, ModelType.UNET)
256 self.torch_unet = self.idx is None or self.hr_idx is None
257
258 try:
259 if not self.torch_unet:
260 self.get_loras(p)
261 except Exception as e:
262 gr.Error(e)
263 raise e
264
265 self.apply_unet(sd_unet_option)
266
267 def apply_unet(self, sd_unet_option):
268 if (

Callers

nothing calls this directly

Calls 3

get_profile_idxMethod · 0.95
get_lorasMethod · 0.95
apply_unetMethod · 0.95

Tested by

no test coverage detected