stable-diffusion-v1-5 · PNN 75 % · INT8
A Prime Neural Network (PNN) version of stable-diffusion-v1-5/stable-diffusion-v1-5, made on primeneural.net. 128 linear layers are PNN layers at 75 % density overall, each layer at its own density from 27 % to 100 % (set by measured damage): in each layer every output reads a fixed, structured set of inputs, the same number for every output, and no index is stored. The weights are INT8 with one scale per output row.
| Original model | stable-diffusion-v1-5/stable-diffusion-v1-5 |
| PNN layers | 128 at 75 % density overall, each layer at its own density from 27 % to 100 % (set by measured damage) |
| Agreement with the original model (CLIP similarity of each finished image to the original's, same prompt and seed, held-out prompts) | 83.95 % |
| Distillation | block-by-block reconstruction of the original's denoiser, then end-to-end rounds, on denoiser calls recorded from the original on a mix of Gustavosta/Stable-Diffusion-Prompts (50 %) and sentence-transformers/coco-captions (50 %) prompts, 15 to 50 sampling steps per prompt (least-squares initialisation; only the PNN layers trained) |
| Model file | 1441.68 MB (INT8; dense parts float16) |
How to load it
This repository holds only the PNN denoiser. The text encoder, VAE, tokenizer and scheduler are the original's, so DiffusionPipeline.from_pretrained on this repository does not work. pnn_load.py (in this repository) loads the original pipeline from stable-diffusion-v1-5/stable-diffusion-v1-5 and puts the PNN denoiser in it.
# pip install torch huggingface_hub diffusers transformers -- and the PNN package on the Python path
import importlib.util, torch
from huggingface_hub import hf_hub_download
REPO = "PrimeNeural/stable-diffusion-v1-5-pnn-d75-int8-j32"
spec = importlib.util.spec_from_file_location("pnn_load", hf_hub_download(REPO, "pnn_load.py"))
pnn_load = importlib.util.module_from_spec(spec); spec.loader.exec_module(pnn_load)
load = pnn_load.load
pipe = load(REPO, device="cuda", dtype=torch.bfloat16) # the full stable-diffusion-v1-5 pipeline
image = pipe("a lighthouse on a cliff at sunset").images[0]
The PNN layers run in plain PyTorch. The PNN kernel library (part of the PNN package) runs them faster on CPUs and NVIDIA GPUs, and primeneural.net serves this model as an inference endpoint.
Licence
The weights are derived from stable-diffusion-v1-5/stable-diffusion-v1-5 and are distributed under its licence, creativeml-openrail-m: see LICENSE.txt in this repository. Its terms apply to this model.
Use restrictions. The licence forbids the uses listed in its Attachment A. They apply to this model unchanged, and whoever you pass the model on to must be bound by them as well.
The PNN file format, pnn_load.py and the PNN package are © PreciseStatistics GmbH; the PNN package is licensed separately (evaluation licence: info@primeneural.net).
© PreciseStatistics GmbH (Prime Neural Networks) · Patent pending (US 19/685,168).
- Downloads last month
- 28
Model tree for PrimeNeural/stable-diffusion-v1-5-pnn-d75-int8-j32
Base model
stable-diffusion-v1-5/stable-diffusion-v1-5