laurent commited on
Commit
31b6568
1 Parent(s): a9a0de2

Initial checkout.

Browse files
README.md CHANGED
@@ -1,3 +1,89 @@
1
  ---
2
  license: creativeml-openrail-m
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: creativeml-openrail-m
3
+ tags:
4
+ - stable-diffusion
5
+ - stable-diffusion-diffusers
6
+ - text-to-image
7
+ - rust
8
+ inference: true
9
+ extra_gated_prompt: |-
10
+ This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage.
11
+ The CreativeML OpenRAIL License specifies:
12
+
13
+ 1. You can't use the model to deliberately produce nor share illegal or harmful outputs or content
14
+ 2. CompVis claims no rights on the outputs you generate, you are free to use them and are accountable for their use which must not go against the provisions set in the license
15
+ 3. You may re-distribute the weights and use the model commercially and/or as a service. If you do, please be aware you have to include the same use restrictions as the ones in the license and share a copy of the CreativeML OpenRAIL-M to all your users (please read the license entirely and carefully)
16
+ Please read the full license carefully here: https://huggingface.co/spaces/CompVis/stable-diffusion-license
17
+
18
+ extra_gated_heading: Please read the LICENSE to access this model
19
  ---
20
+
21
+ This repository hosts weights for a Rust based version of Stable Diffusion.
22
+ These weights have been directly adapted from the
23
+ [stabilityai/stable-diffusion-2-1](https://huggingface.co/stabilityai/stable-diffusion-2-1)
24
+ weights, they can be used with the
25
+ [diffusers-rs](https://github.com/LaurentMazare/diffusers-rs) crate.
26
+
27
+ To do so, checkout the diffusers-rs repo, copy the weights in the `data/`
28
+ directory and run the following command:
29
+
30
+ ```bash
31
+ cargo run --example stable-diffusion --features clap -- --prompt "A rusty robot holding a fire torch."
32
+ ```
33
+
34
+ This is for the image-to-text pipeline, example using the image-to-image and
35
+ inpainting pipelines can be found in the
36
+ [crate readme](https://github.com/LaurentMazare/diffusers-rs/blob/main/README.md).
37
+
38
+
39
+ ## License
40
+ The license is unchanged, see the
41
+ [original version](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL).
42
+ In line with paragraph 4, the original copyright is preserved:
43
+ Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors
44
+
45
+ The model details section below is copied from the runwayml version, refer to
46
+ the [original repo](https://huggingface.co/stabilityai/stable-diffusion-2-1) for
47
+ use restrictions, limitations, bias discussion etc.
48
+
49
+ ## Model Details
50
+ - **Developed by:** Robin Rombach, Patrick Esser
51
+ - **Model type:** Diffusion-based text-to-image generation model
52
+ - **Language(s):** English
53
+ - **License:** [CreativeML Open RAIL++-M License](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/LICENSE-MODEL)
54
+ - **Model Description:** This is a model that can be used to generate and modify images based on text prompts. It is a Latent Diffusion Model that uses a fixed, pretrained text encoder (OpenCLIP-ViT/H).
55
+ - **Resources for more information:** [GitHub Repository](https://github.com/Stability-AI/), [Paper](https://arxiv.org/abs/2112.10752).
56
+ - **Cite as:**
57
+
58
+ @InProceedings{Rombach_2022_CVPR,
59
+ author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
60
+ title = {High-Resolution Image Synthesis With Latent Diffusion Models},
61
+ booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
62
+ month = {June},
63
+ year = {2022},
64
+ pages = {10684-10695}
65
+ }
66
+
67
+ ## Weight Extraction
68
+
69
+ The weights have been converted by downloading them from the stabilityai/stable-diffusion-2-1 repo,
70
+ and then running the following commands in the
71
+ [diffusers-rs repo](https://github.com/LaurentMazare/diffusers-rs).
72
+
73
+ After downloading the files, use Python to convert them to `npz` files.
74
+
75
+ ```python
76
+ import numpy as np
77
+ import torch
78
+ model = torch.load("./vae.bin")
79
+ np.savez("./vae_v2.1.npz", **{k: v.numpy() for k, v in model.items()})
80
+ model = torch.load("./unet.bin")
81
+ np.savez("./unet_v2.1.npz", **{k: v.numpy() for k, v in model.items()})
82
+ ```
83
+
84
+ Convert these `.npz` files to `.ot` files via `tensor-tools`.
85
+
86
+ ```bash
87
+ cargo run --release --example tensor-tools cp ./data/vae_v2.1.npz ./data/vae_v2.1.ot
88
+ cargo run --release --example tensor-tools cp ./data/unet_v2.1.npz ./data/unet_v2.1.ot
89
+ ```
weights/bpe_simple_vocab_16e6.txt ADDED
The diff for this file is too large to render. See raw diff
 
weights/clip_v2.1.ot ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85a8ca1e2550b3d9a6e24384de0e31e9b278bacf3958938f10810b0f589c8bcc
3
+ size 680893926
weights/unet_v2.1.ot ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:519c05b34cf29245fd962d501ea7e93a41ae09d81f68997c57c99d27d9961f75
3
+ size 1732038387
weights/vae_v2.1.ot ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7131925661f136ff34f1cf2d332681b95bd57581afc346009b56a873d52edd34
3
+ size 167383532