| 275 | |
| 276 | @comfy_node(name="LTXVPerStepStatNormPatcher") |
| 277 | class LTXVPerStepStatNormPatcher(PerStepNormPatcher): |
| 278 | @classmethod |
| 279 | def INPUT_TYPES(s): |
| 280 | return { |
| 281 | "required": super().required() |
| 282 | | { |
| 283 | "target_mean": ( |
| 284 | "FLOAT", |
| 285 | { |
| 286 | "default": 0.0, |
| 287 | "min": -10.0, |
| 288 | "max": 10.0, |
| 289 | "step": 0.01, |
| 290 | "round": 0.01, |
| 291 | }, |
| 292 | ), |
| 293 | "target_std": ( |
| 294 | "FLOAT", |
| 295 | { |
| 296 | "default": 1.0, |
| 297 | "min": 0.01, |
| 298 | "max": 10.0, |
| 299 | "step": 0.01, |
| 300 | "round": 0.01, |
| 301 | }, |
| 302 | ), |
| 303 | "percentile": ( |
| 304 | "FLOAT", |
| 305 | { |
| 306 | "default": 95.0, |
| 307 | "min": 50.0, |
| 308 | "max": 100.0, |
| 309 | "step": 0.1, |
| 310 | "round": 0.1, |
| 311 | "tooltip": "Percentile of distribution to use for statistics calculation", |
| 312 | }, |
| 313 | ), |
| 314 | "clip_outliers": ("BOOLEAN", {"default": False}), |
| 315 | }, |
| 316 | } |
| 317 | |
| 318 | RETURN_TYPES = ("MODEL",) |
| 319 | FUNCTION = "patch_model" |
| 320 | |
| 321 | CATEGORY = "Lightricks/latents" |
| 322 | |
| 323 | def patch_model( |
| 324 | self, model, factors, target_mean, target_std, percentile, clip_outliers |
| 325 | ): |
| 326 | def cfg_stat_norm(latent, factor): |
| 327 | return LTXVStatNormLatent().statistical_normalize( |
| 328 | latent, target_mean, target_std, percentile, factor, clip_outliers |
| 329 | ) |
| 330 | |
| 331 | return self.patch_smooth_norm(model, factors, cfg_stat_norm) |
nothing calls this directly
no outgoing calls
no test coverage detected