PaddleNLP icon indicating copy to clipboard operation
PaddleNLP copied to clipboard

[PPDiffusers] Fix ppdiffusers bug and support ZH stablediffusion

Open JunnYu opened this issue 3 years ago • 2 comments

PR types

Bug fixes

PR changes

Models

Description

  • 发布0.6.1版本
  • 支持 IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-v0.1 和 IDEA-CCNL/Taiyi-Stable-Diffusion-1B-Chinese-EN-v0.1 中文权重
  • 修复windows环境下载模型失败的问题。
  • paddlenlp的attention_mask逻辑与HF不一致,因此人工设定全为1的attention_mask。
  • 增添更多的图片后缀格式,ext = ['png', 'jpg', 'jpeg', 'bmp', 'PNG', 'JPG', 'JPEG', 'BMP']
  • 使用AutoTokenizer和AutoModel,这样可以加载BERT和CLIP模型。
  • 删除loading_kwargs["paddle_dtype"] = paddle_dtype。
  • 加载模型默认使用eval模型。

JunnYu avatar Nov 03 '22 05:11 JunnYu

目前出现了 "inf"的问题,需要修改一下

JunnYu avatar Nov 03 '22 09:11 JunnYu

已经修复,替换INF为-1e9,否则0乘float inf会得到 nan

INF = float("-inf")
import paddle
paddle.to_tensor([[1,1,0,0]]) * INF
# Tensor(shape=[1, 4], dtype=float32, place=Place(gpu:0), stop_gradient=True,
#       [[-inf., -inf.,  nan ,  nan ]])

JunnYu avatar Nov 03 '22 10:11 JunnYu