Skip to content

Commit 7125ae1

Browse files
committed
modify code sample
1 parent 0db8119 commit 7125ae1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ppdiffusers/examples/community/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ from clip_guided_stable_diffusion import CLIPGuidedStableDiffusion
2222

2323
from paddlenlp.transformers import CLIPFeatureExtractor, CLIPModel
2424

25-
feature_extractor = CLIPFeatureExtractor.from_pretrained("laion/CLIP-ViT-B-32-laion2B-s34B-b79K")
26-
clip_model = CLIPModel.from_pretrained("laion/CLIP-ViT-B-32-laion2B-s34B-b79K", dtype=paddle.float32)
27-
25+
feature_extractor = CLIPFeatureExtractor.from_pretrained(
26+
"laion/CLIP-ViT-B-32-laion2B-s34B-b79K")
27+
clip_model = CLIPModel.from_pretrained("laion/CLIP-ViT-B-32-laion2B-s34B-b79K",
28+
dtype=paddle.float32)
2829

2930
guided_pipeline = CLIPGuidedStableDiffusion.from_pretrained(
3031
"runwayml/stable-diffusion-v1-5",
@@ -33,11 +34,10 @@ guided_pipeline = CLIPGuidedStableDiffusion.from_pretrained(
3334
paddle_dtype=paddle.float16,
3435
)
3536
guided_pipeline.enable_attention_slicing()
36-
guided_pipeline = guided_pipeline.to("gpu")
3737

3838
prompt = "fantasy book cover, full moon, fantasy forest landscape, golden vector elements, fantasy magic, dark light night, intricate, elegant, sharp focus, illustration, highly detailed, digital painting, concept art, matte, art by WLOP and Artgerm and Albert Bierstadt, masterpiece"
3939

40-
generator = paddle.Generator(device="gpu").manual_seed(0)
40+
generator = paddle.Generator().manual_seed(0)
4141
with paddle.amp.auto_cast(True, level="O2"):
4242
images = []
4343
for i in range(4):

0 commit comments

Comments
 (0)