MohamedRashad
commited on
Commit
•
39d0ec9
1
Parent(s):
7adffaa
Update README.md
Browse files
README.md
CHANGED
@@ -88,34 +88,41 @@ You may reuse the base model text encoder for inference.
|
|
88 |
|
89 |
## Inference
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
```python
|
93 |
import torch
|
94 |
-
from diffusers import DiffusionPipeline
|
95 |
|
96 |
-
model_id =
|
97 |
-
adapter_id =
|
98 |
-
prompt = "A hauntingly eerie illustration of a human skull with fully articulated legs, standing upright, jaw slightly ajar revealing teeth, set against a stark, dark background, with the skull's pale bones starkly contrasting the surrounding shadows, capturing a surreal fusion of human anatomy and skeletal structure in a single, chilling composition."
|
99 |
-
negative_prompt = 'blurry, cropped, ugly'
|
100 |
-
pipeline = DiffusionPipeline.from_pretrained(model_id)
|
101 |
-
pipeline.load_adapter(adapter_id)
|
102 |
-
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
|
103 |
|
104 |
-
prompt = "A
|
105 |
negative_prompt = "blurry, cropped, ugly"
|
106 |
|
107 |
-
pipeline = DiffusionPipeline.from_pretrained(model_id)
|
108 |
-
|
|
|
|
|
109 |
image = pipeline(
|
110 |
prompt=prompt,
|
111 |
-
negative_prompt=
|
112 |
num_inference_steps=30,
|
113 |
-
generator=torch.Generator(device=
|
114 |
-
width=
|
115 |
-
height=
|
116 |
guidance_scale=7.5,
|
117 |
-
guidance_rescale=0.0,
|
118 |
).images[0]
|
119 |
image.save("output.png", format="PNG")
|
|
|
120 |
```
|
121 |
|
|
|
88 |
|
89 |
## Inference
|
90 |
|
91 |
+
First, make sure you have the latest version of `diffusers`
|
92 |
+
```
|
93 |
+
pip install git+https://github.com/huggingface/diffusers.git
|
94 |
+
```
|
95 |
+
or (if the newer version is released)
|
96 |
+
```
|
97 |
+
pip install diffusers==0.30.0
|
98 |
+
```
|
99 |
+
|
100 |
+
Then, use this code here
|
101 |
|
102 |
```python
|
103 |
import torch
|
104 |
+
from diffusers import StableDiffusion3Pipeline as DiffusionPipeline
|
105 |
|
106 |
+
model_id = "stabilityai/stable-diffusion-3-medium-diffusers"
|
107 |
+
adapter_id = "MohamedRashad/sd3-civitai-training"
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
prompt = "A digital artwork capturing a serene moment between a young woman and a black cat, set against a cloudy blue sky with white fluffy clouds and delicate flowers at the bottom. The woman, with her long, wavy pink hair, is elegantly dressed in a blue top featuring a collar, complemented by a flower accessory and a heart-shaped earring. Her striking blue eyes reflect a sense of calm and connection. The black cat, with its glossy coat and a distinctive purple collar, shares a close, affectionate gaze with the woman. The scene is bathed in soft, natural light, with the sun casting a warm, inviting glow on the woman's face, creating a harmonious contrast with the cool, tranquil hues of the sky. The image embodies the essence of 1980s anime, characterized by its pastel color palette and an overall atmosphere of beauty and peacefulness. The artwork is meticulously rendered, showcasing the intricate details of the characters' features, the lush textures of their hair and fur, and the subtle nuances of the environment, all contributing to a visually captivating and emotionally resonant scene."
|
110 |
negative_prompt = "blurry, cropped, ugly"
|
111 |
|
112 |
+
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(
|
113 |
+
"cuda"
|
114 |
+
)
|
115 |
+
pipeline.load_lora_weights(adapter_id)
|
116 |
image = pipeline(
|
117 |
prompt=prompt,
|
118 |
+
negative_prompt=negative_prompt,
|
119 |
num_inference_steps=30,
|
120 |
+
generator=torch.Generator(device="cuda").manual_seed(1641421826),
|
121 |
+
width=1024,
|
122 |
+
height=1024,
|
123 |
guidance_scale=7.5,
|
|
|
124 |
).images[0]
|
125 |
image.save("output.png", format="PNG")
|
126 |
+
|
127 |
```
|
128 |
|