# Install the necessary conversion tools pip install optimum[exporters] diffusers # Export the model optimum-cli export onnx --model stabilityai/stable-diffusion-2-1 output_onnx_folder/ from diffusers import StableDiffusionPipeline import torch # 1. Load base + LoRA pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5") pipe.load_lora_weights("path/to/lora.safetensors") # 2. Fuse the weights into the model pipe.fuse_lora() # 3. Save the fused model pipe.save_pretrained("./fused_model") # Now run the optimum-cli export on "./fused_model" import { pipeline } from '@huggingface/transformers'; // Load the model from your HF repo const generator = await pipeline('text-to-image', 'your-username/your-model-repo', { device: 'webgpu', // This is the magic line }); // Generate an image const output = await generator('a futuristic city in the style of cyberpunk');