Skip to content

Commit 0d79fc2

Browse files
authored
fix(profiling): preserve instance isolation when decorating methods (#13471)
* fix(profiling): preserve instance isolation when decorating methods * fix(profiling): scope instance isolation fix to LTX2 pipelines
1 parent e4d219b commit 0d79fc2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/profiling/profiling_utils.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,16 @@ def annotate_pipeline(pipe):
4545
method = getattr(component, method_name, None)
4646
if method is None:
4747
continue
48-
setattr(component, method_name, annotate(method, label))
48+
49+
# Apply fix ONLY for LTX2 pipelines
50+
if "LTX2" in pipe.__class__.__name__:
51+
func = getattr(method, "__func__", method)
52+
wrapped = annotate(func, label)
53+
bound_method = wrapped.__get__(component, type(component))
54+
setattr(component, method_name, bound_method)
55+
else:
56+
# keep original behavior for other pipelines
57+
setattr(component, method_name, annotate(method, label))
4958

5059
# Annotate pipeline-level methods
5160
if hasattr(pipe, "encode_prompt"):

0 commit comments

Comments
 (0)