Check the model list inside the transformers library.
()
| 207 | |
| 208 | |
| 209 | def check_model_list(): |
| 210 | """Check the model list inside the transformers library.""" |
| 211 | # Get the models from the directory structure of `src/diffusers/models/` |
| 212 | models_dir = os.path.join(PATH_TO_DIFFUSERS, "models") |
| 213 | _models = [] |
| 214 | for model in os.listdir(models_dir): |
| 215 | model_dir = os.path.join(models_dir, model) |
| 216 | if os.path.isdir(model_dir) and "__init__.py" in os.listdir(model_dir): |
| 217 | _models.append(model) |
| 218 | |
| 219 | # Get the models from the directory structure of `src/transformers/models/` |
| 220 | models = [model for model in dir(diffusers.models) if not model.startswith("__")] |
| 221 | |
| 222 | missing_models = sorted(set(_models).difference(models)) |
| 223 | if missing_models: |
| 224 | raise Exception( |
| 225 | f"The following models should be included in {models_dir}/__init__.py: {','.join(missing_models)}." |
| 226 | ) |
| 227 | |
| 228 | |
| 229 | # If some modeling modules should be ignored for all checks, they should be added in the nested list |
no outgoing calls
no test coverage detected