(self)
| 144 | assert config["e"] == [1, 3] |
| 145 | |
| 146 | def test_save_load(self): |
| 147 | obj = SampleObject() |
| 148 | config = obj.config |
| 149 | |
| 150 | assert config["a"] == 2 |
| 151 | assert config["b"] == 5 |
| 152 | assert config["c"] == (2, 5) |
| 153 | assert config["d"] == "for diffusion" |
| 154 | assert config["e"] == [1, 3] |
| 155 | |
| 156 | with tempfile.TemporaryDirectory() as tmpdirname: |
| 157 | obj.save_config(tmpdirname) |
| 158 | new_obj = SampleObject.from_config(SampleObject.load_config(tmpdirname)) |
| 159 | new_config = new_obj.config |
| 160 | |
| 161 | # unfreeze configs |
| 162 | config = dict(config) |
| 163 | new_config = dict(new_config) |
| 164 | |
| 165 | assert config.pop("c") == (2, 5) # instantiated as tuple |
| 166 | assert new_config.pop("c") == [2, 5] # saved & loaded as list because of json |
| 167 | config.pop("_use_default_values") |
| 168 | assert config == new_config |
| 169 | |
| 170 | def test_load_ddim_from_pndm(self): |
| 171 | logger = logging.get_logger("diffusers.configuration_utils") |
nothing calls this directly
no test coverage detected