diff --git a/examples/profiling/profiling_utils.py b/examples/profiling/profiling_utils.py index 1c7d59d42fde..1150ad5ae24d 100644 --- a/examples/profiling/profiling_utils.py +++ b/examples/profiling/profiling_utils.py @@ -45,7 +45,16 @@ def annotate_pipeline(pipe): method = getattr(component, method_name, None) if method is None: continue - setattr(component, method_name, annotate(method, label)) + + # Apply fix ONLY for LTX2 pipelines + if "LTX2" in pipe.__class__.__name__: + func = getattr(method, "__func__", method) + wrapped = annotate(func, label) + bound_method = wrapped.__get__(component, type(component)) + setattr(component, method_name, bound_method) + else: + # keep original behavior for other pipelines + setattr(component, method_name, annotate(method, label)) # Annotate pipeline-level methods if hasattr(pipe, "encode_prompt"):