Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 5th No.87】Add edict_pipeline, pipeline_fabric #307

Merged
merged 9 commits into from
Dec 1, 2023

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Nov 17, 2023

@co63oc
Copy link
Contributor Author

co63oc commented Nov 17, 2023

image
失败CI 为 tests/pipelines/stable_diffusion/test_stable_diffusion_paradigms.py

@co63oc co63oc changed the title 【Hackathon 5th No.87】Add edict part 【Hackathon 5th No.87】Add edict_pipeline, pipeline_fabric Nov 21, 2023
@JunnYu JunnYu self-requested a review November 22, 2023 09:42
Copy link
Contributor

@CrazyBoyM CrazyBoyM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好,
这里需要改为从paddlenlp中加载,代码如下:

from paddlenlp.transformers import CLIPTextModel, CLIPTokenizer

import paddle
from packaging import version
from PIL import Image
from transformers import CLIPTextModel, CLIPTokenizer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from paddlenlp.transformers import CLIPTextModel, CLIPTokenizer

@co63oc
Copy link
Contributor Author

co63oc commented Nov 24, 2023

你好, 这里需要改为从paddlenlp中加载,代码如下:

from paddlenlp.transformers import CLIPTextModel, CLIPTokenizer

已修改

@westfish
Copy link
Contributor

你好,请新建一个ppdiffusers/tests/community/,并将测试文件放到该文件夹下

@co63oc
Copy link
Contributor Author

co63oc commented Nov 24, 2023

你好,请新建一个ppdiffusers/tests/community/,并将测试文件放到该文件夹下

已修改,使用 get_examples_pipeline 获取 examples 目录pipeline

@shiyutang
Copy link
Collaborator

@westfish @CrazyBoyM @JunnYu 请辛苦看是否还有修改需要开发者执行。

@JunnYu
Copy link
Member

JunnYu commented Nov 30, 2023

最后的话,https://github.com/PaddlePaddle/PaddleMIX/blob/develop/ppdiffusers/examples/community/README.md 这里面可以加一下有关这个新pipeline的介绍

@co63oc
Copy link
Contributor Author

co63oc commented Nov 30, 2023

最后的话,https://github.com/PaddlePaddle/PaddleMIX/blob/develop/ppdiffusers/examples/community/README.md 这里面可以加一下有关这个新pipeline的介绍

已增加pipeline @JunnYu

Copy link
Member

@JunnYu JunnYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JunnYu JunnYu merged commit eccaa2b into PaddlePaddle:develop Dec 1, 2023
1 of 3 checks passed
@guoshengCS
Copy link
Collaborator

也想请问下,看于edict生成结果中相较于输入图片在颜色上有一个整体的偏移,这个对所有图片都有这样的情况吗。看原始repo给的case好像没这个情况,这个是否可能是diffusers中实现存在一些问题 https://github.com/salesforce/EDICT ,这个请问下了解不

@co63oc
Copy link
Contributor Author

co63oc commented Dec 1, 2023

也想请问下,看于edict生成结果中相较于输入图片在颜色上有一个整体的偏移,这个对所有图片都有这样的情况吗。看原始repo给的case好像没这个情况,这个是否可能是diffusers中实现存在一些问题 https://github.com/salesforce/EDICT ,这个请问下了解不

不了解,torch测试运行也是同样,https://github.com/salesforce/EDICT 这里如果测试不同那再对比查找是不是有修改

查看代码0.3.0版本,比较不同是float转为double类型
image

@co63oc co63oc deleted the edict branch February 18, 2024 07:02
westfish pushed a commit to westfish/PaddleMIX that referenced this pull request Sep 25, 2024
…e#307)

https://github.com/PaddlePaddle/community/blob/master/hackathon/hackathon_5th/%E3%80%90PaddlePaddle%20Hackathon%205th%E3%80%91%E5%BC%80%E6%BA%90%E8%B4%A1%E7%8C%AE%E4%B8%AA%E4%BA%BA%E6%8C%91%E6%88%98%E8%B5%9B%E5%A5%97%E4%BB%B6%E5%BC%80%E5%8F%91%E4%BB%BB%E5%8A%A1%E5%90%88%E9%9B%86.md#no87paddlemix-ppdiffusers%E6%96%B0%E5%A2%9Ehf-community%E5%BA%94%E7%94%A8pipeline

参考 edict_pipeline.py
https://github.com/huggingface/diffusers/blob/main/examples/community/edict_pipeline.py
基于 ppdiffusers
https://github.com/PaddlePaddle/PaddleMIX/tree/develop/ppdiffusers/examples/community
下的 pipeline 实现

fp16不存在,取消设置revision="fp16"

https://bj.bcebos.com/paddlenlp/models/community/CompVis/stable-diffusion-v1-4/fp16/model_index.json

测试
```
python test_pipeline_fabric.py
python test_edict_pipeline.py
```

原图

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/2913ef2b-7192-4e08-8d7a-4e397fec0cd8)
paddle生成图

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/9cacc784-3be0-4d91-ba1f-e049bd2ec0ad)

torch生成图

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/ef37e202-3e6a-4985-8169-c47ad8e41512)

paddle和torch生成一致

pipeline_fabric.py torch中使用generator=torch.Generator().manual_seed(17)
测试第一张图和paddle一致,修改randn调用第二张图一致
paddle

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/efb1f1d8-dcaa-4250-a90e-198b9ab01ff6)

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/2cc4b360-3c51-43ef-8f4e-292ae776566a)

torch

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/681ac02f-7f0c-44d0-b2db-0d5756cad3ce)

![image](https://github.com/PaddlePaddle/PaddleMIX/assets/4617245/b675a2f2-9756-4390-9c32-1dd103dbd4dc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants