From f9c7013a5070e416096e73108a4d351e8c1c851f Mon Sep 17 00:00:00 2001 From: Pan Daoxin Date: Fri, 17 May 2024 07:41:24 +0000 Subject: [PATCH 1/5] Test ci. --- dicp/dicp/vendor/AscendGraph/conversion.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dicp/dicp/vendor/AscendGraph/conversion.py b/dicp/dicp/vendor/AscendGraph/conversion.py index a56674fba..361709685 100644 --- a/dicp/dicp/vendor/AscendGraph/conversion.py +++ b/dicp/dicp/vendor/AscendGraph/conversion.py @@ -317,6 +317,7 @@ def div(self, x, y): @register_conversion(aten.split.Tensor) def split(self, x, split_size, dim=0): + # test ci splitD_kw = {"from_view_complex": False} shape = list(x.node.meta['val'].shape) if dim < 0: From 7934f2159d52d427f19eeda3ccb426b38efa335c Mon Sep 17 00:00:00 2001 From: Pan Daoxin Date: Fri, 17 May 2024 11:39:52 +0000 Subject: [PATCH 2/5] Move sd decoder stage to ascend compile. --- dicp/dicp/vendor/AscendGraph/conversion.py | 1 - dicp/test/model/test_stable_diffusion.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dicp/dicp/vendor/AscendGraph/conversion.py b/dicp/dicp/vendor/AscendGraph/conversion.py index 361709685..a56674fba 100644 --- a/dicp/dicp/vendor/AscendGraph/conversion.py +++ b/dicp/dicp/vendor/AscendGraph/conversion.py @@ -317,7 +317,6 @@ def div(self, x, y): @register_conversion(aten.split.Tensor) def split(self, x, split_size, dim=0): - # test ci splitD_kw = {"from_view_complex": False} shape = list(x.node.meta['val'].shape) if dim < 0: diff --git a/dicp/test/model/test_stable_diffusion.py b/dicp/test/model/test_stable_diffusion.py index 8999ba1d1..9bad69c61 100644 --- a/dicp/test/model/test_stable_diffusion.py +++ b/dicp/test/model/test_stable_diffusion.py @@ -54,8 +54,8 @@ def test_inference( dicp_pipe.unet = torch.compile(dicp_pipe.unet, backend=backend, dynamic=dynamic) # Temporarily run decoder on CPU - # if backend == "ascendgraph": - # dicp_pipe.vae.decoder = torch.compile(dicp_pipe.vae.decoder, backend=backend, dynamic=dynamic) + if backend == "ascendgraph": + dicp_pipe.vae.decoder = torch.compile(dicp_pipe.vae.decoder, backend=backend, dynamic=dynamic) dicp_image = dicp_pipe(prompt, num_inference_steps=num_inference_steps).images[0] similarity = get_similarity(cpu_image, dicp_image) From 4e49404becc36e13989b1e26def8e6f479bfa62a Mon Sep 17 00:00:00 2001 From: Pan Daoxin Date: Mon, 20 May 2024 02:43:46 +0000 Subject: [PATCH 3/5] Try remove additional module. --- .github/workflows/_runs-on-ascend.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/_runs-on-ascend.yml b/.github/workflows/_runs-on-ascend.yml index 45968748a..8c8cc82dc 100644 --- a/.github/workflows/_runs-on-ascend.yml +++ b/.github/workflows/_runs-on-ascend.yml @@ -39,11 +39,6 @@ jobs: python setup.py install --user && \ patch -R -p1 < modeling_llama.diff && patch -R -p1 < utils.diff && \ cd - && \ - cd /mnt/cache/share/deeplinkci/dicp_env/accelerate && \ - pip uninstall accelerate -y && \ - python setup.py clean && \ - python setup.py install --user && \ - cd - && \ pip uninstall torch_dipu -y && \ pip uninstall dicp -y && \ cd dipu && python setup.py clean && python setup.py install --user && \ From c2714bc147bea20c961f5ec558bdfc5cafb35ad6 Mon Sep 17 00:00:00 2001 From: Pan Daoxin Date: Thu, 23 May 2024 05:12:39 +0000 Subject: [PATCH 4/5] Fix stable_diffusion ci case. --- dicp/test/model/test_stable_diffusion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dicp/test/model/test_stable_diffusion.py b/dicp/test/model/test_stable_diffusion.py index 9bad69c61..8999ba1d1 100644 --- a/dicp/test/model/test_stable_diffusion.py +++ b/dicp/test/model/test_stable_diffusion.py @@ -54,8 +54,8 @@ def test_inference( dicp_pipe.unet = torch.compile(dicp_pipe.unet, backend=backend, dynamic=dynamic) # Temporarily run decoder on CPU - if backend == "ascendgraph": - dicp_pipe.vae.decoder = torch.compile(dicp_pipe.vae.decoder, backend=backend, dynamic=dynamic) + # if backend == "ascendgraph": + # dicp_pipe.vae.decoder = torch.compile(dicp_pipe.vae.decoder, backend=backend, dynamic=dynamic) dicp_image = dicp_pipe(prompt, num_inference_steps=num_inference_steps).images[0] similarity = get_similarity(cpu_image, dicp_image) From 0ac6ccb781b7fd03542e129c0e6fc16bae6592ac Mon Sep 17 00:00:00 2001 From: Pan Daoxin Date: Thu, 23 May 2024 05:56:16 +0000 Subject: [PATCH 5/5] revert. --- .github/workflows/_runs-on-ascend.yml | 5 +++++ dicp/test/model/test_stable_diffusion.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_runs-on-ascend.yml b/.github/workflows/_runs-on-ascend.yml index 8c8cc82dc..45968748a 100644 --- a/.github/workflows/_runs-on-ascend.yml +++ b/.github/workflows/_runs-on-ascend.yml @@ -39,6 +39,11 @@ jobs: python setup.py install --user && \ patch -R -p1 < modeling_llama.diff && patch -R -p1 < utils.diff && \ cd - && \ + cd /mnt/cache/share/deeplinkci/dicp_env/accelerate && \ + pip uninstall accelerate -y && \ + python setup.py clean && \ + python setup.py install --user && \ + cd - && \ pip uninstall torch_dipu -y && \ pip uninstall dicp -y && \ cd dipu && python setup.py clean && python setup.py install --user && \ diff --git a/dicp/test/model/test_stable_diffusion.py b/dicp/test/model/test_stable_diffusion.py index 8999ba1d1..57b24758b 100644 --- a/dicp/test/model/test_stable_diffusion.py +++ b/dicp/test/model/test_stable_diffusion.py @@ -11,7 +11,7 @@ torch_dipu.dipu.set_device(device) models_dir = os.environ.get("STABLE_DIFFUSION_MODEL_DIR") assert models_dir is not None - +# test def get_similarity(cpu_image, dicp_image): cpu_rgb = list(cpu_image.getdata())