File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1902,6 +1902,30 @@ def test_StableDiffusionMixin_component(self):
19021902 )
19031903 )
19041904
1905+ # @pytest.mark.xfail(condition=not os.getenv("RUN_DDUF_TEST", False), strict=True)
1906+ # Should consider guarding the test with proper transformers and huggingface_hub versions.
1907+ def test_save_load_dduf (self ):
1908+ components = self .get_dummy_components ()
1909+ pipe = self .pipeline_class (** components )
1910+ pipe = pipe .to (torch_device )
1911+ pipe .set_progress_bar_config (disable = None )
1912+
1913+ inputs = self .get_dummy_inputs (device = "cpu" )
1914+ inputs .pop ("generator" )
1915+ inputs ["generator" ] = torch .manual_seed (0 )
1916+
1917+ pipeline_out = pipe (** inputs ).images
1918+
1919+ with tempfile .TemporaryDirectory () as tmpdir :
1920+ dduf_filename = f"{ pipe .__class__ .__name__ .lower ()} .dduf"
1921+ pipe .save_pretrained (tmpdir , dduf_file = dduf_filename )
1922+ loaded_pipe = self .pipeline_class .from_pretrained (tmpdir , dduf_file = dduf_filename ).to (torch_device )
1923+
1924+ inputs ["generator" ] = torch .manual_seed (0 )
1925+ loaded_pipeline_out = loaded_pipe (** inputs ).images
1926+
1927+ assert np .allclose (pipeline_out , loaded_pipeline_out )
1928+
19051929
19061930@is_staging_test
19071931class PipelinePushToHubTester (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments