MCPcopy Create free account
hub / github.com/modelscope/modelscope / fix_upgrade

Function fix_upgrade

modelscope/utils/automodel_utils.py:29–36  ·  view source on GitHub ↗
(module_obj: Any)

Source from the content-addressed store, hash-verified

27
28
29def fix_upgrade(module_obj: Any):
30 from transformers import PreTrainedModel
31 if hasattr(module_obj, '_set_gradient_checkpointing') \
32 and 'value' in inspect.signature(
33 module_obj._set_gradient_checkpointing).parameters.keys() \
34 and 'modelscope.' in str(module_obj.__class__):
35 module_obj._set_gradient_checkpointing = MethodType(
36 PreTrainedModel._set_gradient_checkpointing, module_obj)
37
38
39def post_init(self, *args, **kwargs):

Callers 1

post_initFunction · 0.85

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…