Views
No views yet
A peaceful Japanese-inspired scene unfolds, showcasing a cozy retreat nestled in the heart of nature. Towering mountains rise in the distance, framing a serene environment filled with vibrant plants and lush greenery. A calm pond reflects the bright sunlight, its surface adorned with delicate ripples and blooming lotus flowers—where Frog basks on a lily pad, quietly observing the tranquil surroundings. Nearby, a rose garden adds a touch of romance, its soft petals contrasting beautifully with the earthy tones of the environment. Inside the rustic cottage, m0n1t0rs sitting in calm wearing headphones, adding a hint of nostalgic charm that complements the timeless beauty outside. This setting exudes tranquility, inviting you to pause, breathe, and connect with the harmony of nature—a perfect haven where the natural splendor of Japan landscapes meets cozy serenity.3.00.020FlowMatchEulerDiscreteScheduler421344x7681import torch
2from diffusers import DiffusionPipeline
3
4model_id = 'black-forest-labs/FLUX.1-dev'
5adapter_id = 'maver1chh/maver1chh/cha_2501'
6pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
7pipeline.load_lora_weights(adapter_id)
8
9prompt = "A peaceful Japanese-inspired scene unfolds, showcasing a cozy retreat nestled in the heart of nature. Towering mountains rise in the distance, framing a serene environment filled with vibrant plants and lush greenery. A calm pond reflects the bright sunlight, its surface adorned with delicate ripples and blooming lotus flowers—where Frog basks on a lily pad, quietly observing the tranquil surroundings. Nearby, a rose garden adds a touch of romance, its soft petals contrasting beautifully with the earthy tones of the environment. Inside the rustic cottage, m0n1t0rs sitting in calm wearing headphones, adding a hint of nostalgic charm that complements the timeless beauty outside. This setting exudes tranquility, inviting you to pause, breathe, and connect with the harmony of nature—a perfect haven where the natural splendor of Japan landscapes meets cozy serenity."
10
11
12## Optional: quantise the model to save on vram.
13## Note: The model was quantised during training, and so it is recommended to do the same during inference time.
14from optimum.quanto import quantize, freeze, qint8
15quantize(pipeline.transformer, weights=qint8)
16freeze(pipeline.transformer)
17
18pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
19image = pipeline(
20 prompt=prompt,
21 num_inference_steps=20,
22 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
23 width=1344,
24 height=768,
25 guidance_scale=3.0,
26).images[0]
27image.save("output.png", format="PNG")