Open
Description
🐛 Describe the bug
Many discussions show that the current revert functions have several limitations, including:
- incomplete revert: Fix: pailgemma type error #627 (comment)
revert_liger_kernel_to_xxx
can't revert LigerCrossEntropyLoss for transformers>=4.46.1 #542 - not automatically updating old reference: Fix flce not being patched after reverting in convergence test #385
- comparing wrong references: Fix: pailgemma type error #627 (comment)
Simply reloading the modules would generate new class/function objects different from the original ones, i.e. revert(patch(object)) != object
, which can easily lead to bugs when doing comparisons (isinstance()
), repatching, reusing configs and so on.
One way to address the issue is having a patch manager for testing to keep track of replaced objects, so we can easily revert back to the original objects after monkey patch. Or is there a way to achieve it with pytest?
cc @tyler-romero @austin362667
Reproduce
No response
Versions
none
Metadata
Metadata
Assignees
Labels
No labels