Checks all models defined in the library are in the main init.
()
| 296 | |
| 297 | |
| 298 | def check_models_are_in_init(): |
| 299 | """Checks all models defined in the library are in the main init.""" |
| 300 | models_not_in_init = [] |
| 301 | dir_transformers = dir(diffusers) |
| 302 | for module in get_model_modules(): |
| 303 | models_not_in_init += [ |
| 304 | model[0] for model in get_models(module, include_pretrained=True) if model[0] not in dir_transformers |
| 305 | ] |
| 306 | |
| 307 | # Remove private models |
| 308 | models_not_in_init = [model for model in models_not_in_init if not is_a_private_model(model)] |
| 309 | if len(models_not_in_init) > 0: |
| 310 | raise Exception(f"The following models should be in the main init: {','.join(models_not_in_init)}.") |
| 311 | |
| 312 | |
| 313 | # If some test_modeling files should be ignored when checking models are all tested, they should be added in the |
no test coverage detected