mirror of
https://github.com/huggingface/diffusers.git
synced 2026-01-27 17:22:53 +03:00
Fix import structure in __init__.py and update config loading logic in test_config.py
This commit is contained in:
@@ -32,7 +32,7 @@ if is_torch_available():
|
||||
_import_structure["autoencoders.autoencoder_tiny"] = ["AutoencoderTiny"]
|
||||
_import_structure["autoencoders.consistency_decoder_vae"] = ["ConsistencyDecoderVAE"]
|
||||
_import_structure["controlnet"] = ["ControlNetModel"]
|
||||
_import_structure["dual_transformer_2d"] = ["DualTransformer2DModel"]
|
||||
_import_structure["transformers.dual_transformer_2d"] = ["DualTransformer2DModel"]
|
||||
_import_structure["embeddings"] = ["ImageProjection"]
|
||||
_import_structure["modeling_utils"] = ["ModelMixin"]
|
||||
_import_structure["transformers.prior_transformer"] = ["PriorTransformer"]
|
||||
|
||||
@@ -270,19 +270,19 @@ class ConfigTester(unittest.TestCase):
|
||||
config.save_config(tmpdirname)
|
||||
|
||||
# now loading it with SampleObject2 should put f into `_use_default_values`
|
||||
config = SampleObject2.from_config(tmpdirname)
|
||||
config = SampleObject2.from_config(SampleObject2.load_config(tmpdirname))
|
||||
|
||||
assert "f" in config._use_default_values
|
||||
assert config.f == [1, 3]
|
||||
assert "f" in config.config._use_default_values
|
||||
assert config.config.f == [1, 3]
|
||||
|
||||
# now loading the config, should **NOT** use [1, 3] for `f`, but the default [1, 4] value
|
||||
# **BECAUSE** it is part of `config._use_default_values`
|
||||
# **BECAUSE** it is part of `config.config._use_default_values`
|
||||
new_config = SampleObject4.from_config(config.config)
|
||||
assert new_config.f == [5, 4]
|
||||
assert new_config.config.f == [5, 4]
|
||||
|
||||
config.config._use_default_values.pop()
|
||||
new_config_2 = SampleObject4.from_config(config.config)
|
||||
assert new_config_2.f == [1, 3]
|
||||
assert new_config_2.config.f == [1, 3]
|
||||
|
||||
# Nevertheless "e" should still be correctly loaded to [1, 3] from SampleObject2 instead of defaulting to [1, 5]
|
||||
assert new_config_2.e == [1, 3]
|
||||
assert new_config_2.config.e == [1, 3]
|
||||
|
||||
Reference in New Issue
Block a user