Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## LORA Qwen-Image example
|
| 2 |
+
|
| 3 |
+
World first lora for [Qwen-Image](https://huggingface.co/Qwen/Qwen-Image)
|
| 4 |
+
|
| 5 |
+
No trigger word required
|
| 6 |
+
|
| 7 |
+
## π§ͺ Usage
|
| 8 |
+
---
|
| 9 |
+
### π§ Initialization
|
| 10 |
+
|
| 11 |
+
```python
|
| 12 |
+
from diffusers import DiffusionPipeline
|
| 13 |
+
import torch
|
| 14 |
+
|
| 15 |
+
model_name = "Qwen/Qwen-Image"
|
| 16 |
+
|
| 17 |
+
# Load the pipeline
|
| 18 |
+
if torch.cuda.is_available():
|
| 19 |
+
torch_dtype = torch.bfloat16
|
| 20 |
+
device = "cuda"
|
| 21 |
+
else:
|
| 22 |
+
torch_dtype = torch.float32
|
| 23 |
+
device = "cpu"
|
| 24 |
+
|
| 25 |
+
pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
|
| 26 |
+
pipe = pipe.to(device)
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
### π Load LoRA Weights
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
# Load LoRA weights
|
| 33 |
+
pipe.load_lora_weights('pytorch_lora_weights.safetensors', adapter_name="lora")
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
### π¨ Generate Image with lora trained on person
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
prompt = '''Super Realism portrait of a teenager woman of African descent, serene calmness, arms crossed, illuminated by dramatic studio lighting, sunlit park in the background, adorned with delicate jewelry, three-quarter view, sun-kissed skin with natural imperfections, loose shoulder-length curls, slightly squinting eyes, environmental street portrait with text "FLYMY AI" on t-shirt.'''
|
| 40 |
+
negative_prompt = " "
|
| 41 |
+
image = pipe(
|
| 42 |
+
prompt=prompt,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
+
width=1024,
|
| 45 |
+
height=1024,
|
| 46 |
+
num_inference_steps=50,
|
| 47 |
+
true_cfg_scale=5,
|
| 48 |
+
generator=torch.Generator(device="cuda").manual_seed(346346)
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Display the image (in Jupyter or save to file)
|
| 52 |
+
image.show()
|
| 53 |
+
# or
|
| 54 |
+
image.save("output.png")
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### πΌοΈ Sample Output
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
## π€ Support
|
| 63 |
+
|
| 64 |
+
If you have questions or suggestions, join our community:
|
| 65 |
+
- π [FlyMy.AI](https://flymy.ai)
|
| 66 |
+
- π¬ [Discord Community](https://discord.com/invite/t6hPBpSebw)
|
| 67 |
+
- π¦ [Follow us on X](https://x.com/flymyai)
|
| 68 |
+
- πΌ [Connect on LinkedIn](https://linkedin.com/company/flymyai)
|
| 69 |
+
- π§ [Support](mailto:[email protected])
|
| 70 |
+
|
| 71 |
+
**β Don't forget to star the repository if you like it!**
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
license: apache-2.0
|
| 76 |
+
---
|