Image-Text-to-Text
PEFT
Safetensors
Sogand Salehi commited on
Commit
c848260
·
verified ·
1 Parent(s): d3e10b0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -54
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
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/65e071d494c7b01c55483e7d/vISXj2qd9tL4v8VcxCrSW.png)
9
 
10
- ## Example
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
- ```bash
15
- git clone https://github.com/sogandstorme/ViPer_Personalization.git
16
- cd ViPer_Personalization
17
- ```
 
 
 
 
 
 
18
 
19
  ```python
20
- from ViPer import (
21
- set_device,
22
- load_images,
23
- initialize_processor_and_model,
24
- prepare_prompt_and_inputs,
25
- generate_texts,
26
- extract_features,
27
- initialize_pipelines,
28
- generate_images
29
- )
30
-
31
- # Ensure that the order of the comments matches the path of the images they refer to.
32
-
33
- comments = [
34
- "These are beautiful, intricate patterns. Very elegant, and the teal blue colors are lovely. I love the flowing lines.",
35
- "The colors here don't quite work for me. They feel a bit unmatched and artificial. The concept also seems a bit boring and artificial to me.",
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.