OpenVINO™ Stable Diffusion v1.5
This is the OpenVINO™ version of runwayml/stable-diffusion-v1-5 (or stable-diffusion-v1-5/stable-diffusion-v1-5) . Optimized for CPUs, especially for Intels. Also, this version size is only about 5 GB.
HOW TO USE THIS MODEL
First, install needed packages:
pip install optimum[intel] diffusers transformers safetensors huggingface_hub torch numpy Pillow
Then, load model with OVStableDiffusionPipeline:
# Imports
from optimum.intel.openvino import OVStableDiffusionPipeline
from huggingface_hub import login
import torch
from pathlib import Path
# Configuration
MODEL_ID = "HARRY07979/stable-diffusion-v1-5-openvino"
DEVICE = "cpu" # change to "gpu" if you have an Intel GPU
DTYPE = torch.float32 if DEVICE == "cpu" else torch.float16
# Load pipeline
pipe = OVStableDiffusionPipeline.from_pretrained(
MODEL_ID,
export=True,
device=DEVICE,
torch_dtype=DTYPE,
)
# Generation parameters
prompt = "A photorealistic portrait of Harry Potter, detailed, cinematic lighting"
negative_prompt = "low quality, blurry, distorted"
generator = torch.Generator().manual_seed(42)
# Generate image
output = pipe(
prompt,
negative_prompt=negative_prompt,
num_inference_steps=30,
guidance_scale=7.5,
generator=generator,
)
# Save result
output_dir = Path("generated")
output_dir.mkdir(parents=True, exist_ok=True)
output.images[0].save(output_dir / "harry_potter.png")
print(f"Image saved to {output_dir / 'harry_potter.png'}")
Contributing
If you are interested with this project, you can contribute me. This is an open project and I welcome all contributions. Feel free to open a Pull Request!
Thanks! 🥰🥰🥰🥰😆🤗
- Downloads last month
- 62
Model tree for HARRY07979/stable-diffusion-v1-5-openvino
Base model
stable-diffusion-v1-5/stable-diffusion-v1-5