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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- black-forest-labs/FLUX.1-dev
|
| 7 |
+
pipeline_tag: text-to-image
|
| 8 |
+
tags:
|
| 9 |
+
- lora
|
| 10 |
+
- flux
|
| 11 |
+
- flux-dev
|
| 12 |
+
- realism
|
| 13 |
+
- character
|
| 14 |
+
- portrait
|
| 15 |
+
library_name: diffusers
|
| 16 |
+
---
|
| 17 |
+
## LORA FLUX.1-dev example
|
| 18 |
+
|
| 19 |
+
Lora for [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev)
|
| 20 |
+
|
| 21 |
+
**ohwx woman** trigger word required
|
| 22 |
+
|
| 23 |
+
## π About FlyMy.AI
|
| 24 |
+
|
| 25 |
+
Agentic Infra for GenAI. FlyMy.AI is a B2B infrastructure for building and running GenAI Media agents.
|
| 26 |
+
|
| 27 |
+
**π Useful Links:**
|
| 28 |
+
- π [Official Website](https://flymy.ai)
|
| 29 |
+
- π [Documentation](https://docs.flymy.ai/intro)
|
| 30 |
+
- π¬ [Discord Community](https://discord.com/invite/t6hPBpSebw)
|
| 31 |
+
- π€ [LoRA Training Repository](https://github.com/FlyMyAI/flymyai-lora-trainer)
|
| 32 |
+
- π¦ [X (Twitter)](https://x.com/flymyai)
|
| 33 |
+
- πΌ [LinkedIn](https://linkedin.com/company/flymyai)
|
| 34 |
+
- πΊ [YouTube](https://youtube.com/@flymyai)
|
| 35 |
+
- πΈ [Instagram](https://www.instagram.com/flymy_ai)
|
| 36 |
+
|
| 37 |
+
# π§ͺ Usage
|
| 38 |
+
---
|
| 39 |
+
### π§ Initialization
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from diffusers import DiffusionPipeline
|
| 43 |
+
import torch
|
| 44 |
+
|
| 45 |
+
model_name = "black-forest-labs/FLUX.1-dev"
|
| 46 |
+
|
| 47 |
+
# Load the pipeline
|
| 48 |
+
if torch.cuda.is_available():
|
| 49 |
+
torch_dtype = torch.bfloat16
|
| 50 |
+
device = "cuda"
|
| 51 |
+
else:
|
| 52 |
+
torch_dtype = torch.float32
|
| 53 |
+
device = "cpu"
|
| 54 |
+
|
| 55 |
+
pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
|
| 56 |
+
pipe = pipe.to(device)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### π Load LoRA Weights
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
# Load LoRA weights
|
| 63 |
+
pipe.load_lora_weights('flux_anne_hathaway.safetensors', adapter_name="lora")
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### π¨ Generate Image with lora trained on person
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
prompt = '''Portrait of ohwx woman, professional headshot, studio lighting, elegant pose, looking at camera, soft shadows, high quality, detailed facial features, cinematic lighting, 85mm lens, shallow depth of field'''
|
| 70 |
+
negative_prompt = "blurry, low quality, distorted, bad anatomy"
|
| 71 |
+
image = pipe(
|
| 72 |
+
prompt=prompt,
|
| 73 |
+
negative_prompt=negative_prompt,
|
| 74 |
+
width=1024,
|
| 75 |
+
height=1024,
|
| 76 |
+
num_inference_steps=30,
|
| 77 |
+
guidance_scale=3.5,
|
| 78 |
+
generator=torch.Generator(device="cuda").manual_seed(346346)
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
# Display the image (in Jupyter or save to file)
|
| 82 |
+
image.show()
|
| 83 |
+
# or
|
| 84 |
+
image.save("output.png")
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
### πΌοΈ Sample Output
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
|
| 91 |
+
## ποΈ Using with ComfyUI
|
| 92 |
+
|
| 93 |
+
We provide a ready-to-use ComfyUI workflow that works with our trained LoRA models. Follow these steps to set up and use the workflow:
|
| 94 |
+
|
| 95 |
+
### Setup Instructions
|
| 96 |
+
|
| 97 |
+
1. **Download the latest ComfyUI**:
|
| 98 |
+
- Visit the [ComfyUI GitHub repository](https://github.com/comfyanonymous/ComfyUI)
|
| 99 |
+
- Clone or download the latest version
|
| 100 |
+
|
| 101 |
+
2. **Install ComfyUI**:
|
| 102 |
+
- Follow the installation instructions from the [ComfyUI repository](https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file#installing)
|
| 103 |
+
- Make sure all dependencies are properly installed
|
| 104 |
+
|
| 105 |
+
3. **Download FLUX.1-dev model weights**:
|
| 106 |
+
- Go to [FLUX.1-dev model](https://huggingface.co/black-forest-labs/FLUX.1-dev)
|
| 107 |
+
- Download all the model files
|
| 108 |
+
|
| 109 |
+
4. **Place FLUX.1-dev weights in ComfyUI**:
|
| 110 |
+
- Copy the downloaded FLUX.1-dev model files to the appropriate folders in `ComfyUI/models/`
|
| 111 |
+
- Follow the folder structure as specified in the model repository
|
| 112 |
+
|
| 113 |
+
5. **Download our pre-trained LoRA weights**:
|
| 114 |
+
- Visit [flymy-ai/flux-anne-hathaway-lora](https://huggingface.co/flymy-ai/flux-anne-hathaway-lora)
|
| 115 |
+
- Download the LoRA `.safetensors` files
|
| 116 |
+
|
| 117 |
+
6. **Place LoRA weights in ComfyUI**:
|
| 118 |
+
- Copy the LoRA file `flymy-ai/flux-anne-hathaway-lora/pytorch_lora_weights.safetensors` to `ComfyUI/models/loras/`
|
| 119 |
+
|
| 120 |
+
7. **Load the workflow**:
|
| 121 |
+
- Open ComfyUI in your browser
|
| 122 |
+
- Load the workflow file `flux_anne_hathaway_lora_example.json` located in this repository
|
| 123 |
+
- The workflow is pre-configured to work with our LoRA models
|
| 124 |
+
|
| 125 |
+
### Workflow Features
|
| 126 |
+
|
| 127 |
+
- β
Pre-configured for FLUX.1-dev + LoRA inference
|
| 128 |
+
- β
Optimized settings for best quality output
|
| 129 |
+
- β
Easy prompt and parameter adjustment
|
| 130 |
+
- β
Compatible with all our trained LoRA models
|
| 131 |
+
|
| 132 |
+
The ComfyUI workflow provides a user-friendly interface for generating images with our trained LoRA models without needing to write Python code.
|
| 133 |
+
|
| 134 |
+
### πΌοΈ Workflow Screenshot
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
|
| 138 |
+
## π¨ Generation Examples
|
| 139 |
+
|
| 140 |
+
Below are examples of images generated with our Anne Hathaway LoRA model:
|
| 141 |
+
|
| 142 |
+
### Casual Portrait Selfie
|
| 143 |
+
**Prompt**: *"ohwx woman portrait selfie"*
|
| 144 |
+
|
| 145 |
+

|
| 146 |
+
|
| 147 |
+
### Artistic Double Exposure
|
| 148 |
+
**Prompt**: *"ohwx woman perfectly symmetrical young female face close-up, presented with double exposure overlay blending nature textures like leaves and water"*
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
|
| 152 |
+
### Golden Hour Macro Portrait
|
| 153 |
+
**Prompt**: *"ohwx woman Macro photography style close-up of female face with light makeup, focused on eyes and lips, illuminated by golden hour sunlight for warm tones"*
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
|
| 157 |
+
### Cozy Portrait with Panda
|
| 158 |
+
**Prompt**: *"Close-up of ohwx woman in brown knitted turtleneck sweater. Sitting with big black and white panda, hugging it, looking at camera"*
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
|
| 162 |
+
## π Try it Online
|
| 163 |
+
|
| 164 |
+
Test this LoRA model directly in your browser:
|
| 165 |
+
- π [Try on FlyMy.AI Platform](https://app.flymy.ai/models/flymyai/flux-lora-trainer-fast)
|
| 166 |
+
|
| 167 |
+
## π€ Support
|
| 168 |
+
|
| 169 |
+
If you have questions or suggestions, join our community:
|
| 170 |
+
- π [FlyMy.AI](https://flymy.ai)
|
| 171 |
+
- π [Documentation](https://docs.flymy.ai)
|
| 172 |
+
- π» [GitHub](https://github.com/flymy-ai)
|
| 173 |
+
- π¬ [Discord Community](https://discord.com/invite/t6hPBpSebw)
|
| 174 |
+
- π¦ [Follow us on X](https://x.com/flymyai)
|
| 175 |
+
- πΌ [Connect on LinkedIn](https://linkedin.com/company/flymyai)
|
| 176 |
+
- π§ [Support](mailto:support@flymy.ai)
|
| 177 |
+
|
| 178 |
+
**β Don't forget to star the repository if you like it!**
|
| 179 |
+
|
| 180 |
+
---
|
| 181 |
+
license: apache-2.0
|
| 182 |
+
---
|