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

Method apply_loras

scripts/trt.py:77–84  ·  view source on GitHub ↗
(self, refit_dict: dict)

Source from the content-addressed store, hash-verified

75 return out
76
77 def apply_loras(self, refit_dict: dict):
78 if not self.refitted_keys.issubset(set(refit_dict.keys())):
79 # Need to ensure that weights that have been modified before and are not present anymore are reset.
80 self.refitted_keys = set()
81 self.switch_engine()
82
83 self.engine.refit_from_dict(refit_dict, is_fp16=True)
84 self.refitted_keys = set(refit_dict.keys())
85
86 def switch_engine(self):
87 self.loaded_config = self.configs[self.profile_idx]

Callers 1

Calls 2

switch_engineMethod · 0.95
refit_from_dictMethod · 0.80

Tested by

no test coverage detected