ns / README.md
Pushpendrasinghparmar's picture
Update README.md
cfbd2ef verified
metadata
license: creativeml-openrail-m
language:
  - en
base_model:
  - black-forest-labs/FLUX.1-dev
pipeline_tag: text-to-image

Example code

import torch
from diffusers import AutoPipelineForText2Image

# PEFT
from peft import PeftModel, PeftConfig

# 
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# 
print("In progress...")
pipe = AutoPipelineForText2Image.from_pretrained(
    "black-forest-labs/FLUX.1-dev", 
    torch_dtype=torch.float16  # bfloat16
)
pipe.to(device)

# 
print("Loading lora 로드 중...")
pipe.load_lora_weights(
    'Heartsync/Flux-NSFW-uncensored', 
    weight_name='lora.safetensors',
    adapter_name="uncensored"
)

# 이미지 생성
prompt = "A woman in a sheer white dress standing on a beach at sunset"

seed = 42
generator = torch.Generator(device=device).manual_seed(seed)

image = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=7.0,
    num_inference_steps=28,
    width=1024,
    height=1024,
    generator=generator,
).images[0]

image.save("generated_image.png")