Update to transformers v5 (#30566)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: khluu <khluu000@gmail.com> Signed-off-by: Kevin H. Luu <khluu000@gmail.com> Signed-off-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Co-authored-by: khluu <khluu000@gmail.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Co-authored-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
co-authored by
khluu
Cyrus Leung
jiang1.li
parent
6dc9491406
commit
03f8d3a548
@@ -275,6 +275,11 @@ class Base(
|
||||
)
|
||||
class SupportTorchCompileWrapper(cls): ...
|
||||
|
||||
# Preserve __module__ so transformers v5's source-file checks
|
||||
# (e.g. _can_set_experts_implementation) read the original
|
||||
# model's module instead of this file.
|
||||
SupportTorchCompileWrapper.__module__ = cls.__module__
|
||||
|
||||
# Patch the class in its module
|
||||
module = sys.modules[cls.__module__]
|
||||
setattr(module, cls.__name__, SupportTorchCompileWrapper)
|
||||
|
||||
Reference in New Issue
Block a user