-
Notifications
You must be signed in to change notification settings - Fork 645
Open
Description
Problem
The LoRA wrapper classes (LoRADense, LoRAEinsum, LoRADenseGeneral) caused infinite recursion when repr() was called inside a ModuleInterceptor context. This occurred because the default __repr__ implementation called repr(self.wrapped), which could re-trigger the interceptor and create a recursion loop.
Previous State
- Calling
repr()on LoRA modules inside interceptors caused a stack overflow - Made debugging and inspection of LoRA-wrapped modules difficult
- A TODO comment indicated this was a known issue
Solution
Added custom __repr__ methods to all three LoRA wrapper classes that:
- Use
type(self.wrapped).__name__instead ofrepr(self.wrapped)to avoid recursion - Display useful information (rank, wrapped module type, and key attributes)
- Safely access simple attributes without triggering interceptors
Implementation
-
LoRADense.__repr__()- Shows rank and wrapped
Densefeatures
- Shows rank and wrapped
-
LoRAEinsum.__repr__()- Shows rank and wrapped
Einsumeinsum_str/ shape
- Shows rank and wrapped
-
LoRADenseGeneral.__repr__()- Shows rank and wrapped
DenseGeneralfeatures / axis /batch_dims
- Shows rank and wrapped
PR opened for changes: #474
Metadata
Metadata
Assignees
Labels
No labels