From 29cebf0becc0285520b8f8c0933164207d1b0a9f Mon Sep 17 00:00:00 2001 From: Zhongjie Duan <35051019+Artiprocher@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:43:53 +0800 Subject: [PATCH] Update artaug_flux.py --- examples/ArtAug/artaug_flux.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/examples/ArtAug/artaug_flux.py b/examples/ArtAug/artaug_flux.py index 1789ae2..07043f0 100644 --- a/examples/ArtAug/artaug_flux.py +++ b/examples/ArtAug/artaug_flux.py @@ -1,24 +1,14 @@ import torch from diffsynth import ModelManager, FluxImagePipeline, download_customized_models -prompt = "a beautiful Asian girl." - -# Generate an image using FLUX.1-dev -model_manager = ModelManager(torch_dtype=torch.bfloat16, device="cuda", model_id_list=["FLUX.1-dev"]) -pipe = FluxImagePipeline.from_model_manager(model_manager) - -image = pipe(prompt=prompt, seed=0) -image.save("image.jpg") - -# Download and load ArtAug LoRA lora_path = download_customized_models( model_id="DiffSynth-Studio/ArtAug-lora-FLUX.1dev-v1", origin_file_path="merged_lora.safetensors", - local_dir="models/lora", - downloading_priority=["ModelScope", "HuggingFace"] + local_dir="models/lora" )[0] +model_manager = ModelManager(torch_dtype=torch.bfloat16, device="cuda", model_id_list=["FLUX.1-dev"]) model_manager.load_lora(lora_path, lora_alpha=1.0) +pipe = FluxImagePipeline.from_model_manager(model_manager) -# Generate an image using FLUX.1-dev + ArtAug -image = pipe(prompt=prompt, seed=0) +image = pipe(prompt="a house", seed=0) image.save("image_artaug.jpg")