Get the objects in module that are models.
(module, include_pretrained=False)
| 268 | |
| 269 | |
| 270 | def 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 | |
| 283 | def is_a_private_model(model): |
no outgoing calls
no test coverage detected