rahul7star commited on
Commit
e68deed
·
verified ·
1 Parent(s): 6c2bd76

Update app_lora1.py

Browse files
Files changed (1) hide show
  1. app_lora1.py +15 -7
app_lora1.py CHANGED
@@ -100,17 +100,25 @@ def register_pipeline_feature(pipe, text: str):
100
  # =========================================================
101
  def log_pipe_calls(obj, obj_name="pipe"):
102
  for attr_name in dir(obj):
 
 
103
  attr = getattr(obj, attr_name)
104
- if callable(attr) and not attr_name.startswith("_"):
105
- def make_wrapper(f, name):
106
- def wrapper(*args, **kwargs):
107
- log(f"• {obj_name}.{name} called with args={args}, kwargs={kwargs}")
108
- return f(*args, **kwargs)
109
- return wrapper
110
- setattr(obj, attr_name, make_wrapper(attr, attr_name))
 
 
 
 
 
111
  return obj
112
 
113
 
 
114
  # =========================================================
115
  # DOWNLOAD SCRIPTS
116
  # =========================================================
 
100
  # =========================================================
101
  def log_pipe_calls(obj, obj_name="pipe"):
102
  for attr_name in dir(obj):
103
+ if attr_name.startswith("_"):
104
+ continue
105
  attr = getattr(obj, attr_name)
106
+
107
+ # Skip non-callables or torch modules
108
+ if not callable(attr) or isinstance(attr, torch.nn.Module):
109
+ continue
110
+
111
+ def make_wrapper(f, name):
112
+ def wrapper(*args, **kwargs):
113
+ log(f"• {obj_name}.{name} called with args={args}, kwargs={kwargs}")
114
+ return f(*args, **kwargs)
115
+ return wrapper
116
+
117
+ setattr(obj, attr_name, make_wrapper(attr, attr_name))
118
  return obj
119
 
120
 
121
+
122
  # =========================================================
123
  # DOWNLOAD SCRIPTS
124
  # =========================================================