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

Method compile

modelscope/models/base/base_torch_model.py:135–149  ·  view source on GitHub ↗

Compile torch model with torch>=2.0 Args: kwargs: backend: The backend param of torch.compile mode: The mode param of torch.compile

(self, **kwargs)

Source from the content-addressed store, hash-verified

133 save_config_function(target_folder, config)
134
135 def compile(self, **kwargs):
136 """Compile torch model with torch>=2.0
137
138 Args:
139 kwargs:
140 backend: The backend param of torch.compile
141 mode: The mode param of torch.compile
142 """
143 if version.parse(torch.__version__) >= version.parse('2.0.0.dev'):
144 return torch.compile(self, **kwargs)
145 else:
146 logger.warning(
147 f'Torch compiling needs torch version >= 2.0.0, your torch version is : {torch.__version__},'
148 f' returns original model')
149 return self

Callers 15

compile_modelFunction · 0.45
__call__Method · 0.45
discover_import_namesFunction · 0.45
_lid_preprocessMethod · 0.45
split_parts_by_regexFunction · 0.45
__init__Method · 0.45
__init__Method · 0.45
fill_blanksFunction · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by 1

__call__Method · 0.36