MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_models

Function get_models

diffusers/utils/check_repo.py:270–280  ·  view source on GitHub ↗

Get the objects in module that are models.

(module, include_pretrained=False)

Source from the content-addressed store, hash-verified

268
269
270def get_models(module, include_pretrained=False):
271 """Get the objects in module that are models."""
272 models = []
273 model_classes = (diffusers.ModelMixin, diffusers.TFModelMixin, diffusers.FlaxModelMixin)
274 for attr_name in dir(module):
275 if not include_pretrained and ("Pretrained" in attr_name or "PreTrained" in attr_name):
276 continue
277 attr = getattr(module, attr_name)
278 if isinstance(attr, type) and issubclass(attr, model_classes) and attr.__module__ == module.__name__:
279 models.append((attr_name, attr))
280 return models
281
282
283def is_a_private_model(model):

Callers 3

check_models_are_in_initFunction · 0.85
check_models_are_testedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected