model card added
Browse files
README.md
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: openrail++
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: diffusers
|
6 |
+
tags:
|
7 |
+
- text-to-image
|
8 |
+
- prior
|
9 |
+
- unclip
|
10 |
+
- kandinskyv2.2
|
11 |
+
---
|
12 |
+
|
13 |
+
|
14 |
+
# Introduction
|
15 |
+
|
16 |
+
This ECLIPSE model weight is a tiny (33M parameter) non-diffusion text-to-image prior model trained on 5M LAION-HighRes subset data.
|
17 |
+
|
18 |
+
Despite being so small and trained on limited amount of data, ECLIPSE priors achieves results that of 1 Billion parameter T2I prior models trained on millions of image-text pairs.
|
19 |
+
|
20 |
+
## Installation
|
21 |
+
```bash
|
22 |
+
git clone git@github.com:eclipse-t2i/eclipse-inference.git
|
23 |
+
|
24 |
+
conda create -p ./venv python=3.9
|
25 |
+
pip install -r requirements.txt
|
26 |
+
```
|
27 |
+
|
28 |
+
## Run Inference
|
29 |
+
|
30 |
+
This repository supports two pre-trained image decoders: [Karlo-v1-alpha](https://huggingface.co/kakaobrain/karlo-v1-alpha) and [Kandinsky-v2.2](https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder).
|
31 |
+
Note: ECLIPSE prior is not a diffusion model -- while image decoders are.
|
32 |
+
|
33 |
+
### Karlo Inference
|
34 |
+
```python
|
35 |
+
from src.pipelines.pipeline_unclip import UnCLIPPipeline
|
36 |
+
from src.priors.prior_transformer import PriorTransformer
|
37 |
+
|
38 |
+
prior = PriorTransformer.from_pretrained("ECLIPSE-Community/ECLIPSE_Karlo_Prior")
|
39 |
+
pipe = UnCLIPPipeline.from_pretrained("kakaobrain/karlo-v1-alpha", prior=prior).to("cuda")
|
40 |
+
|
41 |
+
prompt="black apples in the basket"
|
42 |
+
images = pipe(prompt, decoder_guidance_scale=7.5).images
|
43 |
+
|
44 |
+
images[0]
|
45 |
+
```
|
46 |
+
|
47 |
+
### Kandinsky Inference
|
48 |
+
```python
|
49 |
+
from src.pipelines.pipeline_kandinsky_prior import KandinskyPriorPipeline
|
50 |
+
from src.priors.prior_transformer import PriorTransformer
|
51 |
+
from diffusers import DiffusionPipeline
|
52 |
+
|
53 |
+
prior = PriorTransformer.from_pretrained("ECLIPSE-Community/ECLIPSE_KandinskyV22_Prior")
|
54 |
+
pipe_prior = KandinskyPriorPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-prior", prior=prior).to("cuda")
|
55 |
+
|
56 |
+
pipe = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-decoder").to("cuda")
|
57 |
+
|
58 |
+
prompt = "black apples in the basket"
|
59 |
+
image_embeds, negative_image_embeds = pipe_prior(prompt).to_tuple()
|
60 |
+
images = pipe(
|
61 |
+
num_inference_steps=50,
|
62 |
+
image_embeds=image_embeds,
|
63 |
+
negative_image_embeds=negative_image_embeds,
|
64 |
+
).images
|
65 |
+
|
66 |
+
images[0]
|
67 |
+
```
|