Update README.md
Browse files
README.md
CHANGED
@@ -45,21 +45,23 @@ The `diffusion_pytorch_model_onlinehps.safetensors` is online version of SRPO ba
|
|
45 |
#### Inference
|
46 |
Replace the `ddiffusion_pytorch_model_onlinehps.safetensors` of FLUX
|
47 |
```python
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
```
|
64 |
### License
|
65 |
SRPO is licensed under the License Terms of SRPO. See `./License.txt` for more details.
|
|
|
45 |
#### Inference
|
46 |
Replace the `ddiffusion_pytorch_model_onlinehps.safetensors` of FLUX
|
47 |
```python
|
48 |
+
from diffusers import FluxPipeline
|
49 |
+
prompt='The Death of Ophelia by John Everett Millais, Pre-Raphaelite painting, Ophelia floating in a river surrounded by flowers, detailed natural elements, melancholic and tragic atmosphere'
|
50 |
+
pipe = FluxPipeline.from_pretrained('./data/flux',
|
51 |
+
torch_dtype=torch.bfloat16,
|
52 |
+
use_safetensors=True
|
53 |
+
).to("cuda")
|
54 |
+
state_dict = load_file("./srpo/diffusion_pytorch_model.safetensors")
|
55 |
+
pipe.transformer.load_state_dict(state_dict)
|
56 |
+
image = pipe(
|
57 |
+
prompt,
|
58 |
+
guidance_scale=3.5,
|
59 |
+
height=1024,
|
60 |
+
width=1024,
|
61 |
+
num_inference_steps=infer_step,
|
62 |
+
max_sequence_length=512,
|
63 |
+
generator=generator
|
64 |
+
).images[0]
|
65 |
```
|
66 |
### License
|
67 |
SRPO is licensed under the License Terms of SRPO. See `./License.txt` for more details.
|