Skip to content

Commit 6223519

Browse files
authored
[PPDiffusers] update deploy readme (PaddlePaddle#295)
导出时候设置环境变量,USE_PPXFORMERS=False
1 parent 3c1f9ee commit 6223519

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

ppdiffusers/deploy/export.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ ___Tips: Stable Diffusion 是基于以下的 License: The CreativeML OpenRAIL M
1212
可执行以下命令行完成模型导出。
1313

1414
```shell
15-
python export_model.py --pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 --output_path stable-diffusion-v1-5 --height=512 --width=512
15+
# 关闭ppxformers,否则会导致模型导出失败
16+
export USE_PPXFORMERS=False
17+
python export_model.py --pretrained_model_name_or_path runwayml/stable-diffusion-v1-5 --output_path stable-diffusion-v1-5
1618
```
17-
注: 上述指令导出固定尺寸的模型,固定尺寸的导出模型有利于优化模型推理性能,但会牺牲一定灵活性。若要导出支持多种推理尺寸的模型,可取消参数--height和--width的设置
19+
注: 上述指令没有导出固定尺寸的模型,固定尺寸的导出模型有利于优化模型推理性能,但会牺牲一定灵活性。若要导出固定尺寸的模型,可指定`--height``--width`参数
1820

1921
输出的模型目录结构如下:
2022

ppdiffusers/deploy/export_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
import argparse
1616
import os
17+
# set USE_PPXFORMERS=False to avoid using ppxformers
18+
os.environ["USE_PPXFORMERS"] = "False"
1719
from pathlib import Path
1820
from types import MethodType
1921

@@ -40,8 +42,6 @@ def convert_ppdiffusers_pipeline_to_fastdeploy_pipeline(
4042
pipeline = StableDiffusionPipeline.from_pretrained(
4143
model_path, unet=unet_model, safety_checker=None, feature_extractor=None
4244
)
43-
# make sure we disable xformers
44-
pipeline.disable_xformers_memory_efficient_attention()
4545
output_path = Path(output_path)
4646
# calculate latent's H and W
4747
latent_height = height // 8 if height is not None else None

ppdiffusers/examples/stable_diffusion/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ python create_pretraining_data.py \
8383
* `--image_key`: jsonl文件中,每一行数据表示图片的 key 值,默认为`image`
8484
* `--per_part_file_num`: 每个part文件保存的数据数量,默认为`1000`
8585
* `--save_gzip_file`: 是否将文件保存为`gzip`的格式,默认为`False`
86-
* `--num_repeat`: `custom_dataset.filelist`文件中`part数据`的重复次数,默认为`1`。当前我们设置成`100`是为了能够制造更多的`part数据`,可以防止程序运行时会卡住,如果用户有很多数据的时候,可以无修改该默认值
86+
* `--num_repeat`: `custom_dataset.filelist`文件中`part数据`的重复次数,默认为`1`。当前我们设置成`100`是为了能够制造更多的`part数据`,可以防止程序运行时会卡住,如果用户有很多数据的时候,无需修改该默认值
8787

8888
运行上述命令后,会生成 `./processed_data` 文件夹。
8989
```

0 commit comments

Comments
 (0)