alexrame commited on
Commit
0467ec9
1 Parent(s): ec5c4ad

[First commit]

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +42 -0
  2. assets/assets/images/soup.jpg +0 -0
  3. assets/images/icon.png +0 -0
  4. assets/styles.css +186 -0
  5. data/imgen/data.pkl +0 -0
  6. data/imgen/data_images.pkl +0 -0
  7. data/imgen/viz3/003594a888_0.png +0 -0
  8. data/imgen/viz3/003594a888_1.png +0 -0
  9. data/imgen/viz3/003594a888_10.png +0 -0
  10. data/imgen/viz3/003594a888_2.png +0 -0
  11. data/imgen/viz3/003594a888_3.png +0 -0
  12. data/imgen/viz3/003594a888_4.png +0 -0
  13. data/imgen/viz3/003594a888_5.png +0 -0
  14. data/imgen/viz3/003594a888_6.png +0 -0
  15. data/imgen/viz3/003594a888_7.png +0 -0
  16. data/imgen/viz3/003594a888_8.png +0 -0
  17. data/imgen/viz3/003594a888_9.png +0 -0
  18. data/imgen/viz3/02d9f671c1_0.png +0 -0
  19. data/imgen/viz3/02d9f671c1_1.png +0 -0
  20. data/imgen/viz3/02d9f671c1_10.png +0 -0
  21. data/imgen/viz3/02d9f671c1_2.png +0 -0
  22. data/imgen/viz3/02d9f671c1_3.png +0 -0
  23. data/imgen/viz3/02d9f671c1_4.png +0 -0
  24. data/imgen/viz3/02d9f671c1_5.png +0 -0
  25. data/imgen/viz3/02d9f671c1_6.png +0 -0
  26. data/imgen/viz3/02d9f671c1_7.png +0 -0
  27. data/imgen/viz3/02d9f671c1_8.png +0 -0
  28. data/imgen/viz3/02d9f671c1_9.png +0 -0
  29. data/imgen/viz3/22550e7610_0.png +0 -0
  30. data/imgen/viz3/22550e7610_1.png +0 -0
  31. data/imgen/viz3/22550e7610_10.png +0 -0
  32. data/imgen/viz3/22550e7610_2.png +0 -0
  33. data/imgen/viz3/22550e7610_3.png +0 -0
  34. data/imgen/viz3/22550e7610_4.png +0 -0
  35. data/imgen/viz3/22550e7610_5.png +0 -0
  36. data/imgen/viz3/22550e7610_6.png +0 -0
  37. data/imgen/viz3/22550e7610_7.png +0 -0
  38. data/imgen/viz3/22550e7610_8.png +0 -0
  39. data/imgen/viz3/22550e7610_9.png +0 -0
  40. data/imgen/viz3/576a8b2407_0.png +0 -0
  41. data/imgen/viz3/576a8b2407_1.png +0 -0
  42. data/imgen/viz3/576a8b2407_10.png +0 -0
  43. data/imgen/viz3/576a8b2407_2.png +0 -0
  44. data/imgen/viz3/576a8b2407_3.png +0 -0
  45. data/imgen/viz3/576a8b2407_4.png +0 -0
  46. data/imgen/viz3/576a8b2407_5.png +0 -0
  47. data/imgen/viz3/576a8b2407_6.png +0 -0
  48. data/imgen/viz3/576a8b2407_7.png +0 -0
  49. data/imgen/viz3/576a8b2407_8.png +0 -0
  50. data/imgen/viz3/576a8b2407_9.png +0 -0
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from utils import inject_custom_css
3
+ from PIL import Image
4
+ from matplotlib import rcParams
5
+
6
+ color_title = "#000000"
7
+ color_text = "#000000"
8
+
9
+ text = f"""
10
+ <p style="text-align: center; font-size: 40px; font-weight: bold;">🍲 Rewarded soups 🍲</p>
11
+ <p style="text-align: center;">Welcome to our interactive streamlit app showcasing the key concepts and experiments presented in our paper <br><a href="https://github.com/alexrame/rewardedsoups" target="_blank" style="color: #007BFF;">Rewarded soups: towards Pareto-optimal alignment by interpolating weights fine-tuned on diverse rewards</a></p>
12
+ <h3 > Asbtract </h3>
13
+ <p style="text-align: justify;"> Foundation models are first pre-trained on vast unsupervised datasets and then fine-tuned on labeled data. Reinforcement learning, notably from human feedback (RLHF), can further align the network with the intended usage. Yet the imperfections in the proxy reward may hinder the training and lead to suboptimal results; the diversity of objectives in real-world tasks and human opinions exacerbate the issue. This paper proposes embracing the heterogeneity of diverse rewards by following a multi-policy strategy. Rather than focusing on a single a priori reward, we aim for Pareto-optimal generalization across the entire space of preferences. To this end, we propose rewarded soup, first specializing multiple networks independently (one for each proxy reward) and then interpolating their weights linearly. This succeeds empirically because we show that the weights remain linearly connected when fine-tuned on diverse rewards from a shared pre-trained initialization. We demonstrate the effectiveness of our approach for text-to-text (summarization, Q&A, helpful assistant, review), text-image (image captioning, text-to-image generation, visual grounding, VQA), and control (locomotion) tasks. We hope to enhance the alignment of deep models, and how they interact with the world in all its diversity.</p>
14
+
15
+ <h3 >What will I find here ?</h3>
16
+
17
+ <p style="text-align: justify;">In this app, you will find interactive figures and qualitative examples demonstratating the effectiveness of our approach. Specifically, we detail the following tasks: RLHF of LLaMA for news summarization, RLHF of a diffusion model for text-to-image generation, and the locomotion task. To help the reproduction of these results, we also provide <a href="https://github.com/alexrame/rewardedsoups" target="_blank" style="color: #007BFF;">our code here</a>.</p>
18
+ """
19
+
20
+
21
+ def run_UI():
22
+ rcParams['font.family'] = 'sans-serif'
23
+ rcParams['font.sans-serif'] = ['Tahoma']
24
+ inject_custom_css("streamlit_app/assets/styles.css")
25
+
26
+ st.markdown(
27
+ f"""
28
+ <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
29
+ {text}
30
+ """,
31
+ unsafe_allow_html=True,
32
+ )
33
+
34
+ if __name__ == "__main__":
35
+ img = Image.open("streamlit_app/assets/images/icon.png")
36
+ st.set_page_config(
37
+ page_title="Rewarded soups",
38
+ page_icon=img,
39
+ layout="wide",
40
+ )
41
+ st.set_option("deprecation.showPyplotGlobalUse", False)
42
+ run_UI()
assets/assets/images/soup.jpg ADDED
assets/images/icon.png ADDED
assets/styles.css ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .settings{
3
+ height:1rem;
4
+ }
5
+
6
+ div{
7
+ text-align: justify;
8
+ }
9
+
10
+ div[role="button"]{
11
+ font-size: 16px;
12
+ }
13
+
14
+ h6{
15
+ font-size: 14px;
16
+ }
17
+
18
+ h1{
19
+ text-align: center !important;
20
+ }
21
+ h4{
22
+ text-align: center !important;
23
+ }
24
+
25
+ table{
26
+ font-size: 0.8vw;
27
+ text-align: right !important;
28
+ }
29
+
30
+ .promptTextbox {
31
+ border: 2px solid #f3f3f3;
32
+ border-radius: 5px;
33
+ background-color: #f9f9f9;
34
+ box-shadow: 2px 2px 2px grey;
35
+ font-size: 11px;
36
+ margin: 0;
37
+ padding: 0;
38
+ }
39
+
40
+ .promptHeader {
41
+ padding: 10px !important;
42
+ background-color: #ececec;
43
+ border-bottom: 1px solid #ddd;
44
+ font-weight: bold;
45
+ font-size: 16px;
46
+ margin: 0;
47
+ padding: 0;
48
+ }
49
+
50
+ .promptContent {
51
+ padding: 20px;
52
+ }
53
+
54
+ .modelOutputBox {
55
+ border: 2px solid #c3e6cb;
56
+ border-radius: 5px;
57
+ background-color: #d4edda;
58
+ box-shadow: 2px 2px 2px #73c476;
59
+ font-size: 14px;
60
+
61
+ }
62
+
63
+ .modelOutputHeader {
64
+ padding: 10px;
65
+ background-color: #ececec;
66
+ border-bottom: 1px solid #73c476;
67
+ font-weight: bold;
68
+ font-size: 16px;
69
+ }
70
+
71
+ .modelOutputContent {
72
+ padding: 20px;
73
+ }
74
+
75
+ .st-bx {
76
+ padding: 10px;
77
+ background-color: #ececec;
78
+ border-bottom: 1px solid #ddd;
79
+ font-weight: bold;
80
+ font-size: 16px;
81
+ margin: 0;
82
+ padding: 0;
83
+ }
84
+
85
+ .lambda-header {
86
+ padding: 2px;
87
+ background-color: #d4edda;
88
+ font-weight: bold; /* make the text bold */
89
+ font-size: 16px;
90
+ width: 50px; /* reduce the width */
91
+ height: 30px; /* reduce the width */
92
+ box-shadow: 2px 2px 2px grey; /* same shadow as .lambdas */
93
+ text-align: center;
94
+ }
95
+
96
+ .lambdas {
97
+ padding: 10px;
98
+ background-color: #d4edda; /* same color as .lambda-header */
99
+ font-size: 16px;
100
+ box-shadow: 2px 2px 2px grey;
101
+ margin-bottom: 10px; /* creates space between this section and the next */
102
+ overflow: hidden; /* this will prevent text exceeding the height from being visible */
103
+ height: auto; /* adjust this to fit your text, accounting for padding and font size */
104
+ width: auto;
105
+ }
106
+
107
+ .imgContent {
108
+ display: flex;
109
+ justify-content: center;
110
+ padding: 20px;
111
+ }
112
+
113
+ .imgContainer {
114
+ display: flex;
115
+ flex-direction: column;
116
+ align-items: center;
117
+ width: 30%;
118
+ max-width: 30%;
119
+ margin: 10px;
120
+ }
121
+
122
+ .imglambda-header {
123
+ padding: 2px;
124
+ font-weight: bold; /* make the text bold */
125
+ font-size: 16px;
126
+ width: 50px; /* reduce the width */
127
+ height: 30px; /* reduce the width */
128
+ text-align: center;
129
+ }
130
+
131
+ .imglambdas {
132
+ padding: 10px;
133
+ background-color: #d4edda; /* same color as .lambda-header */
134
+ font-size: 16px;
135
+ box-shadow: 2px 2px 2px grey;
136
+ margin-bottom: 10px; /* creates space between this section and the next */
137
+ overflow: hidden; /* this will prevent text exceeding the height from being visible */
138
+ height: auto; /* adjust this to fit your text, accounting for padding and font size */
139
+ width: 100%;
140
+ max-width: 100%;
141
+ display: flex;
142
+ justify-content: center; /* Add this line to center the content horizontally */
143
+ align-items: center; /* Add this line to center the content vertically */
144
+ }
145
+ .imglambdas img {
146
+ max-height: 99%;
147
+ max-width: 99%; /* adjust to your preference */
148
+
149
+ }
150
+
151
+ div[data-testid='stHorizontalBlock'] {
152
+ display: flex;
153
+ align-items: center; /* this will vertically center the items */
154
+ padding: 0; /* removes padding */
155
+ margin: 0; /* removes margin */
156
+ }
157
+
158
+ div[data-testid='column'] {
159
+ justify-content: center; /* this will horizontally center the plot */
160
+ padding: 0; /* removes padding */
161
+ margin: 0; /* removes margin */
162
+ }
163
+
164
+ @keyframes typing {
165
+ from { width: 0; }
166
+ to { width: 100%; }
167
+ }
168
+
169
+ @keyframes blink-caret {
170
+ 0%, 100% { border-color: transparent; }
171
+ 50% { border-color: black; }
172
+ }
173
+
174
+ .typing-effect {
175
+ border-right: .15em solid black;
176
+ white-space: nowrap;
177
+ overflow: hidden;
178
+ margin: 0 auto;
179
+ animation: typing 2s steps(40, end), blink-caret 2.8s step-end;
180
+ }
181
+
182
+ .flex-container {
183
+ display: flex;
184
+ flex-wrap: wrap;
185
+ justify-content: center;
186
+ }
data/imgen/data.pkl ADDED
Binary file (607 Bytes). View file
 
data/imgen/data_images.pkl ADDED
Binary file (1.41 kB). View file
 
data/imgen/viz3/003594a888_0.png ADDED
data/imgen/viz3/003594a888_1.png ADDED
data/imgen/viz3/003594a888_10.png ADDED
data/imgen/viz3/003594a888_2.png ADDED
data/imgen/viz3/003594a888_3.png ADDED
data/imgen/viz3/003594a888_4.png ADDED
data/imgen/viz3/003594a888_5.png ADDED
data/imgen/viz3/003594a888_6.png ADDED
data/imgen/viz3/003594a888_7.png ADDED
data/imgen/viz3/003594a888_8.png ADDED
data/imgen/viz3/003594a888_9.png ADDED
data/imgen/viz3/02d9f671c1_0.png ADDED
data/imgen/viz3/02d9f671c1_1.png ADDED
data/imgen/viz3/02d9f671c1_10.png ADDED
data/imgen/viz3/02d9f671c1_2.png ADDED
data/imgen/viz3/02d9f671c1_3.png ADDED
data/imgen/viz3/02d9f671c1_4.png ADDED
data/imgen/viz3/02d9f671c1_5.png ADDED
data/imgen/viz3/02d9f671c1_6.png ADDED
data/imgen/viz3/02d9f671c1_7.png ADDED
data/imgen/viz3/02d9f671c1_8.png ADDED
data/imgen/viz3/02d9f671c1_9.png ADDED
data/imgen/viz3/22550e7610_0.png ADDED
data/imgen/viz3/22550e7610_1.png ADDED
data/imgen/viz3/22550e7610_10.png ADDED
data/imgen/viz3/22550e7610_2.png ADDED
data/imgen/viz3/22550e7610_3.png ADDED
data/imgen/viz3/22550e7610_4.png ADDED
data/imgen/viz3/22550e7610_5.png ADDED
data/imgen/viz3/22550e7610_6.png ADDED
data/imgen/viz3/22550e7610_7.png ADDED
data/imgen/viz3/22550e7610_8.png ADDED
data/imgen/viz3/22550e7610_9.png ADDED
data/imgen/viz3/576a8b2407_0.png ADDED
data/imgen/viz3/576a8b2407_1.png ADDED
data/imgen/viz3/576a8b2407_10.png ADDED
data/imgen/viz3/576a8b2407_2.png ADDED
data/imgen/viz3/576a8b2407_3.png ADDED
data/imgen/viz3/576a8b2407_4.png ADDED
data/imgen/viz3/576a8b2407_5.png ADDED
data/imgen/viz3/576a8b2407_6.png ADDED
data/imgen/viz3/576a8b2407_7.png ADDED
data/imgen/viz3/576a8b2407_8.png ADDED
data/imgen/viz3/576a8b2407_9.png ADDED