|
1 | 1 | import gc |
2 | | -import json |
3 | | -import os |
4 | 2 | from typing import Callable |
5 | 3 |
|
6 | 4 | import pytest |
@@ -349,32 +347,6 @@ def test_save_from_pretrained(self, tmp_path): |
349 | 347 |
|
350 | 348 | assert torch.abs(image_slices[0] - image_slices[1]).max() < 1e-3 |
351 | 349 |
|
352 | | - def test_modular_index_consistency(self, tmp_path): |
353 | | - pipe = self.get_pipeline() |
354 | | - components_spec = pipe._component_specs |
355 | | - components = sorted(components_spec.keys()) |
356 | | - |
357 | | - pipe.save_pretrained(tmp_path) |
358 | | - index_file = os.path.join(tmp_path, "modular_model_index.json") |
359 | | - assert os.path.exists(index_file) |
360 | | - |
361 | | - with open(index_file) as f: |
362 | | - index_contents = json.load(f) |
363 | | - |
364 | | - compulsory_keys = {"_blocks_class_name", "_class_name", "_diffusers_version"} |
365 | | - for k in compulsory_keys: |
366 | | - assert k in index_contents |
367 | | - |
368 | | - to_check_attrs = {"pretrained_model_name_or_path", "revision", "subfolder"} |
369 | | - for component in components: |
370 | | - spec = components_spec[component] |
371 | | - for attr in to_check_attrs: |
372 | | - if getattr(spec, "pretrained_model_name_or_path", None) is not None: |
373 | | - for attr in to_check_attrs: |
374 | | - assert component in index_contents, f"{component} should be present in index but isn't." |
375 | | - attr_value_from_index = index_contents[component][2][attr] |
376 | | - assert getattr(spec, attr) == attr_value_from_index |
377 | | - |
378 | 350 | def test_workflow_map(self): |
379 | 351 | blocks = self.pipeline_blocks_class() |
380 | 352 | if blocks._workflow_map is None: |
|
0 commit comments