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

Function compile_model

modelscope/utils/torch_utils.py:38–49  ·  view source on GitHub ↗
(model, **compile_options)

Source from the content-addressed store, hash-verified

36
37
38def compile_model(model, **compile_options):
39 # Compile the model with torch 2.0
40 if hasattr(model, 'compile'):
41 model = model.compile(**compile_options)
42 elif version.parse(torch.__version__) >= version.parse('2.0.0.dev'):
43 model = torch.compile(model, **compile_options)
44 else:
45 print(
46 'Compiling model needs torch version > 2.0.0, '
47 f'your torch version is: {torch.__version__}, origin model will be returned.'
48 )
49 return model
50
51
52def init_dist(launcher: str, backend: str = 'nccl', **kwargs) -> None:

Callers 2

prepare_modelMethod · 0.90
__init__Method · 0.90

Calls 2

printFunction · 0.85
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…