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

Method _get_framework

modelscope/pipelines/base.py:193–209  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

191 self._model_prepare_lock.release()
192
193 def _get_framework(self) -> str:
194 frameworks = []
195 for m in self.models:
196 if isinstance(m, str):
197 model_dir = m
198 else:
199 model_dir = m.model_dir
200 cfg_file = osp.join(model_dir, ModelFile.CONFIGURATION)
201 cfg = Config.from_file(cfg_file)
202 frameworks.append(cfg.framework)
203 if not all(x == frameworks[0] for x in frameworks):
204 logger.warning(
205 f'got multiple models, but they are in different frameworks {frameworks}'
206 )
207 return None
208
209 return frameworks[0]
210
211 def __call__(self, input: Union[Input, List[Input]], *args,
212 **kwargs) -> Union[Dict[str, Any], Generator]:

Callers 1

__init__Method · 0.95

Calls 2

from_fileMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected