Sogand Salehi
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,64 +1,44 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
3 |
---
|
4 |
|
5 |
# ViPer: Visual Personalization of Generative Models via Individual Preference Learning
|
6 |
-
GitHub: https://github.com/sogandstorme/ViPer_Personalization
|
7 |
|
8 |
-
|
9 |
|
10 |
-
|
11 |
|
12 |
-
To use ViPer, start by cloning it from our GitHub page. For effective personalization, we recommend commenting on at least eight images.
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
```python
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
image_paths = [
|
39 |
-
"/images/6.png",
|
40 |
-
"/images/9.png"
|
41 |
-
]
|
42 |
-
|
43 |
-
prompts = [
|
44 |
-
"Whimsical tea party in a bioluminescent forest",
|
45 |
-
"Tiny houses on top of each other above clouds"
|
46 |
-
]
|
47 |
-
|
48 |
-
output_dir = "results/"
|
49 |
-
|
50 |
-
device = set_device("cuda:0")
|
51 |
-
|
52 |
-
# Initialize processor, model and inputs
|
53 |
-
images = load_images(image_paths)
|
54 |
-
processor, model = initialize_processor_and_model(device)
|
55 |
-
inputs = prepare_prompt_and_inputs(processor, images, comments)
|
56 |
-
|
57 |
-
# Generate and extract vp
|
58 |
-
generated_texts = generate_texts(processor, model, inputs)
|
59 |
-
vp_pos, vp_neg = extract_features(generated_texts)
|
60 |
-
|
61 |
-
# Initialize pipelines and generate images
|
62 |
-
pipe, refiner = initialize_pipelines(device)
|
63 |
-
generate_images(pipe, refiner, prompts, vp_pos, vp_neg, output_dir)
|
64 |
-
```
|
|
|
1 |
---
|
2 |
+
license: other
|
3 |
+
license_name: sample-code-license
|
4 |
+
license_link: LICENSE
|
5 |
+
library_name: viper-vpe
|
6 |
---
|
7 |
|
8 |
# ViPer: Visual Personalization of Generative Models via Individual Preference Learning
|
|
|
9 |
|
10 |
+
*Tuning-free framework for personalized image generation*
|
11 |
|
12 |
+
[`Website`](https://viper.epfl.ch) | [`GitHub`](https://github.com/EPFL-VILAB/ViPer) | [`BibTeX`](#citation)
|
13 |
|
|
|
14 |
|
15 |
+
We introduce **ViPer**, a method that personalizes the output of generative models to align with different users’ visual preferences for the same prompt. This is done via a one-time capture of the user’s general preferences and conditioning the generative model on them without the need for engineering detailed prompts. Notice how the results vary for the same prompt for different users based on their visual preferences in the above figure.
|
16 |
+
|
17 |
+
|
18 |
+
## Installation
|
19 |
+
For install instructions, please see https://github.com/EPFL-VILAB/ViPer.
|
20 |
+
|
21 |
+
|
22 |
+
## Usage
|
23 |
+
|
24 |
+
This model can be loaded from Hugging Face Hub as follows:
|
25 |
|
26 |
```python
|
27 |
+
model = AutoModelForVision2Seq.from_pretrained("HuggingFaceM4/idefics2-8b").to(device)
|
28 |
+
model = PeftModel.from_pretrained(model, "EPFL-VILAB/VPE-ViPer").to(device)
|
29 |
+
```
|
30 |
+
|
31 |
+
Please see https://github.com/EPFL-VILAB/ViPer for more detailed instructions.
|
32 |
+
|
33 |
+
For more examples and interactive demos, please see our [`website`](https://viper.epfl.ch/) and [`Hugging Face Space`](https://huggingface.co/spaces/EPFL-VILAB/ViPer).
|
34 |
+
|
35 |
+
## Citation
|
36 |
+
|
37 |
+
If you find this repository helpful, please consider citing our work:
|
38 |
+
```
|
39 |
+
TODO
|
40 |
+
```
|
41 |
+
|
42 |
+
## License
|
43 |
+
|
44 |
+
Licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/sogandstorme/ViPer_Personalization/blob/main/LICENSE) for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|