Update README.md
Browse files
README.md
CHANGED
|
@@ -14,22 +14,22 @@ pipeline_tag: text-to-image
|
|
| 14 |
import torch
|
| 15 |
from diffusers import AutoPipelineForText2Image
|
| 16 |
|
| 17 |
-
# PEFT
|
| 18 |
from peft import PeftModel, PeftConfig
|
| 19 |
|
| 20 |
-
#
|
| 21 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
print("
|
| 25 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
| 26 |
"black-forest-labs/FLUX.1-dev",
|
| 27 |
-
torch_dtype=torch.float16 # bfloat16
|
| 28 |
)
|
| 29 |
pipe.to(device)
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
print("
|
| 33 |
pipe.load_lora_weights(
|
| 34 |
'Heartsync/Flux-NSFW-uncensored',
|
| 35 |
weight_name='lora.safetensors',
|
|
@@ -37,14 +37,11 @@ pipe.load_lora_weights(
|
|
| 37 |
)
|
| 38 |
|
| 39 |
# 이미지 생성
|
| 40 |
-
prompt = "A woman in a sheer white dress standing on a beach at sunset
|
| 41 |
-
negative_prompt = "text, watermark, signature, cartoon, anime, illustration, painting, drawing, low quality, blurry"
|
| 42 |
|
| 43 |
-
# 시드 설정
|
| 44 |
seed = 42
|
| 45 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 46 |
|
| 47 |
-
# 이미지 생성
|
| 48 |
image = pipe(
|
| 49 |
prompt=prompt,
|
| 50 |
negative_prompt=negative_prompt,
|
|
@@ -55,6 +52,5 @@ image = pipe(
|
|
| 55 |
generator=generator,
|
| 56 |
).images[0]
|
| 57 |
|
| 58 |
-
# 이미지 저장
|
| 59 |
image.save("generated_image.png")
|
| 60 |
```
|
|
|
|
| 14 |
import torch
|
| 15 |
from diffusers import AutoPipelineForText2Image
|
| 16 |
|
| 17 |
+
# PEFT
|
| 18 |
from peft import PeftModel, PeftConfig
|
| 19 |
|
| 20 |
+
#
|
| 21 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 22 |
|
| 23 |
+
#
|
| 24 |
+
print("In progress...")
|
| 25 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
| 26 |
"black-forest-labs/FLUX.1-dev",
|
| 27 |
+
torch_dtype=torch.float16 # bfloat16
|
| 28 |
)
|
| 29 |
pipe.to(device)
|
| 30 |
|
| 31 |
+
#
|
| 32 |
+
print("Loading lora 로드 중...")
|
| 33 |
pipe.load_lora_weights(
|
| 34 |
'Heartsync/Flux-NSFW-uncensored',
|
| 35 |
weight_name='lora.safetensors',
|
|
|
|
| 37 |
)
|
| 38 |
|
| 39 |
# 이미지 생성
|
| 40 |
+
prompt = "A woman in a sheer white dress standing on a beach at sunset"
|
|
|
|
| 41 |
|
|
|
|
| 42 |
seed = 42
|
| 43 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 44 |
|
|
|
|
| 45 |
image = pipe(
|
| 46 |
prompt=prompt,
|
| 47 |
negative_prompt=negative_prompt,
|
|
|
|
| 52 |
generator=generator,
|
| 53 |
).images[0]
|
| 54 |
|
|
|
|
| 55 |
image.save("generated_image.png")
|
| 56 |
```
|