File size: 4,398 Bytes
d0dc8e3
 
 
 
 
 
 
 
 
 
 
 
 
 
8dcca17
d0dc8e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8dcca17
d0dc8e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
license: apache-2.0
language:
- en
base_model:
- Qwen/Qwen-Image
pipeline_tag: text-to-image
tags:
- lora
- qwen
- qwen-image
- anime
- anime-to-real
- style-transfer
library_name: diffusers
---
## Anime in Real Life LoRA for Qwen-Image

LoRA model that transforms anime-style prompts into photorealistic images for [Qwen-Image](https://huggingface.co/Qwen/Qwen-Image)

trigger word: **"Real life Anime"**

# πŸ“ Updates

# πŸ§ͺ Usage

## πŸ”§ Initialization

```python
from diffusers import DiffusionPipeline
import torch

model_name = "Qwen/Qwen-Image"

# Load the pipeline
if torch.cuda.is_available():
    torch_dtype = torch.bfloat16
    device = "cuda"
else:
    torch_dtype = torch.float32
    device = "cpu"

pipe = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch_dtype)
pipe = pipe.to(device)
```

### πŸ”Œ Load LoRA Weights

```python
# Load LoRA weights
pipe.load_lora_weights("flymy-ai/qwen-image-anime-irl-lora", weight_name='flymy_anime_irl.safetensors', adapter_name="lora")
```

### 🎨 Generate Anime in Real Life Images

```python
prompt = '''Real life Anime in a cozy kitchen, eating noodles with chopsticks, while a curious cat looks out the window.'''
negative_prompt = " "
image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=1024,
    height=1024,
    num_inference_steps=50,
    true_cfg_scale=4,
    generator=torch.Generator(device="cuda").manual_seed(4633346 + 2) 
).images[0]

# Display the image (in Jupyter or save to file)
image.show()
# or
image.save("output.png")
```

### πŸ–ΌοΈ Sample Outputs

Examples of anime characters transformed into photorealistic images:

## πŸŽ›οΈ Using with ComfyUI

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:

### Setup Instructions

1. **Download the latest ComfyUI**:
   - Visit the [ComfyUI GitHub repository](https://github.com/comfyanonymous/ComfyUI)
   - Clone or download the latest version

2. **Install ComfyUI**:
   - Follow the installation instructions from the [ComfyUI repository](https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file#installing)
   - Make sure all dependencies are properly installed

3. **Download Qwen-Image model weights**:
   - Go to [Qwen-Image ComfyUI weights](https://huggingface.co/Comfy-Org/Qwen-Image_ComfyUI/tree/main)
   - Download all the model files

4. **Place Qwen-Image weights in ComfyUI**:
   - Copy the downloaded Qwen-Image model files to the appropriate folders in `ComfyUI/models/`
   - Follow the folder structure as specified in the model repository

5. **Download our pre-trained LoRA weights**:
   - Visit [flymy-ai/qwen-image-lora](https://huggingface.co/flymy-ai/qwen-image-lora)
   - Download the LoRA `.safetensors` files

6. **Place LoRA weights in ComfyUI**:
   - Copy the LoRA file `flymy-ai/qwen-image-lora/pytorch_lora_weights.safetensors` to `ComfyUI/models/loras/`

7. **Load the workflow**:
   - Open ComfyUI in your browser
   - Load the workflow file `qwen_image_lora_example.json` located in this repository
   - The workflow is pre-configured to work with our LoRA models

### Workflow Features

- βœ… Pre-configured for Qwen-Image + LoRA inference
- βœ… Optimized settings for best quality output
- βœ… Easy prompt and parameter adjustment
- βœ… Compatible with all our trained LoRA models

The ComfyUI workflow provides a user-friendly interface for generating images with our trained LoRA models without needing to write Python code.

### πŸ–ΌοΈ Workflow Screenshot

![ComfyUI Workflow](./assets/comfyui_workflow.png)

## πŸ“Š Anime to Real Life Examples

Below are examples showing how our LoRA model transforms anime-style descriptions into photorealistic images:

### Example 1

![Anime to Real Life Example 1](./assets/irl_lora1.jpg)

### Example 2

![Anime to Real Life Example 2](./assets/irl_lora2.jpg)

### Example 3

![Anime to Real Life Example 3](./assets/irl_lora3.jpg)

## 🀝 Support

If you have questions or suggestions, join our community:

- 🌐 [FlyMy.AI](https://flymy.ai)
- πŸ’¬ [Discord Community](https://discord.com/invite/t6hPBpSebw)
- 🐦 [Follow us on X](https://x.com/flymyai)
- πŸ’Ό [Connect on LinkedIn](https://linkedin.com/company/flymyai)
- πŸ“§ [Support](mailto:support@flymy.ai)

**⭐ Don't forget to star the repository if you like it!**

---
license: apache-2.0
---