Views
No views yet
A photo-realistic image of a cat4.50.030None421024x10241{
2 "bypass_mode": true,
3 "algo": "lokr",
4 "multiplier": 1.0,
5 "full_matrix": true,
6 "linear_dim": 10000,
7 "linear_alpha": 1,
8 "factor": 4,
9 "apply_preset": {
10 "target_module": [
11 "Attention",
12 "FeedForward"
13 ],
14 "module_algo_map": {
15 "FeedForward": {
16 "factor": 4
17 },
18 "JointTransformerBlock": {
19 "factor": 2
20 }
21 }
22 }
23}1import torch
2from diffusers import DiffusionPipeline
3from lycoris import create_lycoris_from_weights
4
5model_id = 'stabilityai/stable-diffusion-3.5-medium'
6adapter_id = 'pytorch_lora_weights.safetensors' # you will have to download this manually
7lora_scale = 1.0
8wrapper, _ = create_lycoris_from_weights(lora_scale, adapter_id, pipeline.transformer)
9wrapper.merge_to()
10
11prompt = "A photo-realistic image of a cat"
12negative_prompt = 'ugly, cropped, blurry, low-quality, mediocre average'
13pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
14image = pipeline(
15 prompt=prompt,
16 negative_prompt=negative_prompt,
17 num_inference_steps=30,
18 generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(1641421826),
19 width=1024,
20 height=1024,
21 guidance_scale=4.5,
22).images[0]
23image.save("output.png", format="PNG")