Views
No views yet
sdxl-fp16-loras-nsfw/
├── loras/
│ └── sdxl/ # SDXL LoRA adapters (.safetensors)
└── README.md # This file.safetensors format.loras/sdxl/*.safetensors - Individual LoRA adapter files1from diffusers import DiffusionPipeline
2import torch
3
4# Load base SDXL model
5pipe = DiffusionPipeline.from_pretrained(
6 "stabilityai/stable-diffusion-xl-base-1.0",
7 torch_dtype=torch.float16,
8 variant="fp16"
9)
10pipe.to("cuda")
11
12# Load LoRA weights
13lora_path = "E:/huggingface/sdxl-fp16-loras-nsfw/loras/sdxl/example_lora.safetensors"
14pipe.load_lora_weights(lora_path)
15
16# Generate image
17prompt = "your prompt here"
18image = pipe(
19 prompt=prompt,
20 num_inference_steps=30,
21 guidance_scale=7.5,
22 cross_attention_kwargs={"scale": 0.8} # LoRA strength (0.0-1.0)
23).images[0]
24
25image.save("output.png")1# Load multiple LoRAs with different strengths
2pipe.load_lora_weights(
3 "E:/huggingface/sdxl-fp16-loras-nsfw/loras/sdxl/style_lora.safetensors",
4 adapter_name="style"
5)
6pipe.load_lora_weights(
7 "E:/huggingface/sdxl-fp16-loras-nsfw/loras/sdxl/character_lora.safetensors",
8 adapter_name="character"
9)
10
11# Set adapter weights
12pipe.set_adapters(["style", "character"], adapter_weights=[0.7, 0.8])
13
14# Generate with combined LoRAs
15image = pipe(prompt).images[0]1# Enable memory optimizations
2pipe.enable_model_cpu_offload()
3pipe.enable_vae_slicing()
4pipe.enable_attention_slicing()
5
6# Generate with reduced memory footprint
7image = pipe(
8 prompt,
9 num_inference_steps=25,
10 guidance_scale=7.5
11).images[0]ComfyUI/models/loras/stable-diffusion-webui/models/Lora/<lora:filename:strength>
beautiful portrait <lora:style_lora:0.8>1# Aggressive memory optimization
2pipe.enable_model_cpu_offload()
3pipe.enable_vae_tiling()
4pipe.enable_attention_slicing(slice_size=1)
5
6# Clear cache between generations
7import gc
8gc.collect()
9torch.cuda.empty_cache()1@misc{sdxl-fp16-loras-nsfw,
2 title={SDXL FP16 LoRA Collection - NSFW},
3 author={Community Contributors},
4 year={2025},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/sdxl-fp16-loras-nsfw}}
7}
8
9@article{rombach2022stable,
10 title={High-Resolution Image Synthesis with Latent Diffusion Models},
11 author={Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj{\"o}rn},
12 journal={CVPR},
13 year={2022}
14}
15
16@article{hu2021lora,
17 title={LoRA: Low-Rank Adaptation of Large Language Models},
18 author={Hu, Edward J and Shen, Yelong and Wallis, Phillip and Allen-Zhu, Zeyuan and Li, Yuanzhi and Wang, Shean and Wang, Lu and Chen, Weizhu},
19 journal={arXiv preprint arXiv:2106.09685},
20 year={2021}
21}