Upload vbow_umap.ipynb
Browse files- .gitattributes +1 -0
- vbow_umap.ipynb +3 -213
.gitattributes
CHANGED
@@ -65,3 +65,4 @@ data_01_027/profession_images_preds_clusters_all_BLIP.json filter=lfs diff=lfs m
|
|
65 |
profession_images_preds_clusters_all_BLIP.json filter=lfs diff=lfs merge=lfs -text
|
66 |
data_01_027/identity_images_preds_clusters_all_CLIP.json filter=lfs diff=lfs merge=lfs -text
|
67 |
data_01_027/profession_images_preds_clusters_all_CLIP.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
65 |
profession_images_preds_clusters_all_BLIP.json filter=lfs diff=lfs merge=lfs -text
|
66 |
data_01_027/identity_images_preds_clusters_all_CLIP.json filter=lfs diff=lfs merge=lfs -text
|
67 |
data_01_027/profession_images_preds_clusters_all_CLIP.json filter=lfs diff=lfs merge=lfs -text
|
68 |
+
vbow_umap.ipynb filter=lfs diff=lfs merge=lfs -text
|
vbow_umap.ipynb
CHANGED
@@ -1,213 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"id": "26854af0-2aae-4764-9e14-f16587f6ffca",
|
7 |
-
"metadata": {},
|
8 |
-
"outputs": [],
|
9 |
-
"source": [
|
10 |
-
"from datasets import load_dataset, concatenate_datasets\n",
|
11 |
-
"from diffusion_bias_utils import *"
|
12 |
-
]
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"cell_type": "code",
|
16 |
-
"execution_count": 2,
|
17 |
-
"id": "171a7474-8cbf-43e3-a291-43b72aafa2c9",
|
18 |
-
"metadata": {},
|
19 |
-
"outputs": [
|
20 |
-
{
|
21 |
-
"name": "stderr",
|
22 |
-
"output_type": "stream",
|
23 |
-
"text": [
|
24 |
-
"Using custom data configuration SDbiaseval--jobs-sd-1.4-d63e0b445a615372\n",
|
25 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--jobs-sd-1.4-d63e0b445a615372/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n",
|
26 |
-
"Using custom data configuration SDbiaseval--jobs-dalle-2-867ccf66f8ddd10b\n",
|
27 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--jobs-dalle-2-867ccf66f8ddd10b/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n",
|
28 |
-
"Using custom data configuration SDbiaseval--jobs-sd-2-c69d12bb9ccf4085\n",
|
29 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--jobs-sd-2-c69d12bb9ccf4085/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n",
|
30 |
-
"Using custom data configuration SDbiaseval--identities-sd-1.4-235039a7036de834\n",
|
31 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--identities-sd-1.4-235039a7036de834/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n",
|
32 |
-
"Using custom data configuration SDbiaseval--identities-dalle-2-c8f3cfde132be9d1\n",
|
33 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--identities-dalle-2-c8f3cfde132be9d1/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n",
|
34 |
-
"Using custom data configuration SDbiaseval--identities-sd-2-86893313f44c7ca2\n",
|
35 |
-
"Found cached dataset parquet (/mnt/1da05489-3812-4f15-a6e5-c8d3c57df39e/cache/huggingface/SDbiaseval___parquet/SDbiaseval--identities-sd-2-86893313f44c7ca2/0.0.0/2a3b91fbd88a2c90d1dbbb32b460cf621d31bd5b05b934492fdef7d8d6f236ec)\n"
|
36 |
-
]
|
37 |
-
}
|
38 |
-
],
|
39 |
-
"source": [
|
40 |
-
"jobs_1_4 = load_dataset(\"SDbiaseval/jobs-sd-1.4\", split=\"train\")\n",
|
41 |
-
"jobs_dalle = load_dataset(\"SDbiaseval/jobs-dalle-2\", split=\"train\")\n",
|
42 |
-
"jobs_2 = load_dataset(\"SDbiaseval/jobs-sd-2\", split=\"train\")\n",
|
43 |
-
"\n",
|
44 |
-
"identities_1_4 = load_dataset(\"SDbiaseval/identities-sd-1.4\", split=\"train\")\n",
|
45 |
-
"identities_dalle = load_dataset(\"SDbiaseval/identities-dalle-2\", split=\"train\")\n",
|
46 |
-
"identities_2 = load_dataset(\"SDbiaseval/identities-sd-2\", split=\"train\")\n",
|
47 |
-
"\n",
|
48 |
-
"jobs = concatenate_datasets([jobs_1_4, jobs_2, jobs_dalle])\n",
|
49 |
-
"identities = concatenate_datasets([identities_1_4, identities_2, identities_dalle])"
|
50 |
-
]
|
51 |
-
},
|
52 |
-
{
|
53 |
-
"cell_type": "code",
|
54 |
-
"execution_count": 3,
|
55 |
-
"id": "f70be9d9-494b-4499-8663-fc4f2d98ef47",
|
56 |
-
"metadata": {},
|
57 |
-
"outputs": [
|
58 |
-
{
|
59 |
-
"data": {
|
60 |
-
"text/plain": [
|
61 |
-
"Dataset({\n",
|
62 |
-
" features: ['adjective', 'profession', 'no', 'image_path', 'image'],\n",
|
63 |
-
" num_rows: 94500\n",
|
64 |
-
"})"
|
65 |
-
]
|
66 |
-
},
|
67 |
-
"execution_count": 3,
|
68 |
-
"metadata": {},
|
69 |
-
"output_type": "execute_result"
|
70 |
-
}
|
71 |
-
],
|
72 |
-
"source": [
|
73 |
-
"jobs"
|
74 |
-
]
|
75 |
-
},
|
76 |
-
{
|
77 |
-
"cell_type": "code",
|
78 |
-
"execution_count": 4,
|
79 |
-
"id": "2cef9d9e-55d9-476d-81d4-114ef2651033",
|
80 |
-
"metadata": {},
|
81 |
-
"outputs": [
|
82 |
-
{
|
83 |
-
"data": {
|
84 |
-
"text/plain": [
|
85 |
-
"Dataset({\n",
|
86 |
-
" features: ['ethnicity', 'gender', 'no', 'image_path', 'image'],\n",
|
87 |
-
" num_rows: 2040\n",
|
88 |
-
"})"
|
89 |
-
]
|
90 |
-
},
|
91 |
-
"execution_count": 4,
|
92 |
-
"metadata": {},
|
93 |
-
"output_type": "execute_result"
|
94 |
-
}
|
95 |
-
],
|
96 |
-
"source": [
|
97 |
-
"identities"
|
98 |
-
]
|
99 |
-
},
|
100 |
-
{
|
101 |
-
"cell_type": "code",
|
102 |
-
"execution_count": 5,
|
103 |
-
"id": "9fb6ce40-9d5d-4c73-a1b5-30e19dc0066b",
|
104 |
-
"metadata": {},
|
105 |
-
"outputs": [],
|
106 |
-
"source": [
|
107 |
-
"gender_shapes = {\n",
|
108 |
-
" \"man_SD_14\": \"square-cross\",\n",
|
109 |
-
" \"woman_SD_14\": \"diamond-cross\",\n",
|
110 |
-
" \"non-binary_SD_14\": \"circle-cross\",\n",
|
111 |
-
" \"person_SD_14\": \"cross\",\n",
|
112 |
-
" \"man_SD_2\": \"square-x\",\n",
|
113 |
-
" \"woman_SD_2\": \"diamond-x\",\n",
|
114 |
-
" \"non-binary_SD_2\": \"circle-x\",\n",
|
115 |
-
" \"person_SD_2\": \"x\",\n",
|
116 |
-
" \"man_DallE\": \"square\",\n",
|
117 |
-
" \"woman_DallE\": \"diamond\",\n",
|
118 |
-
" \"non-binary_DallE\": \"circle\",\n",
|
119 |
-
" \"person_DallE\": \"star\",\n",
|
120 |
-
"}"
|
121 |
-
]
|
122 |
-
},
|
123 |
-
{
|
124 |
-
"cell_type": "code",
|
125 |
-
"execution_count": 6,
|
126 |
-
"id": "c50ad850-68d3-4985-ad4b-f1e530f68597",
|
127 |
-
"metadata": {},
|
128 |
-
"outputs": [],
|
129 |
-
"source": [
|
130 |
-
"folders = [\"jobs\", \"identities\"]\n",
|
131 |
-
"tfidf_dimensions = [768, 1536, 10752]\n",
|
132 |
-
"svd_dimensions = [32, 100, 128, 768]"
|
133 |
-
]
|
134 |
-
},
|
135 |
-
{
|
136 |
-
"cell_type": "code",
|
137 |
-
"execution_count": 7,
|
138 |
-
"id": "e2a506cc-558e-46a3-b156-f16d9c157e3f",
|
139 |
-
"metadata": {},
|
140 |
-
"outputs": [
|
141 |
-
{
|
142 |
-
"name": "stdout",
|
143 |
-
"output_type": "stream",
|
144 |
-
"text": [
|
145 |
-
"(94500, 32)\n",
|
146 |
-
"(94500, 100)\n",
|
147 |
-
"(94500, 128)\n",
|
148 |
-
"(94500, 768)\n",
|
149 |
-
"(94500, 32)\n",
|
150 |
-
"(94500, 100)\n",
|
151 |
-
"(94500, 128)\n",
|
152 |
-
"(94500, 768)\n",
|
153 |
-
"(94500, 32)\n",
|
154 |
-
"(94500, 100)\n",
|
155 |
-
"(94500, 128)\n",
|
156 |
-
"(94500, 768)\n",
|
157 |
-
"(2040, 32)\n",
|
158 |
-
"(2040, 100)\n",
|
159 |
-
"(2040, 128)\n",
|
160 |
-
"(2040, 768)\n",
|
161 |
-
"(2040, 32)\n",
|
162 |
-
"(2040, 100)\n",
|
163 |
-
"(2040, 128)\n",
|
164 |
-
"(2040, 768)\n",
|
165 |
-
"(2040, 32)\n",
|
166 |
-
"(2040, 100)\n",
|
167 |
-
"(2040, 128)\n",
|
168 |
-
"(2040, 768)\n"
|
169 |
-
]
|
170 |
-
}
|
171 |
-
],
|
172 |
-
"source": [
|
173 |
-
"figs = []\n",
|
174 |
-
"for folder in folders:\n",
|
175 |
-
" for tfidf_dimension in tfidf_dimensions:\n",
|
176 |
-
" for svd_dimension in svd_dimensions:\n",
|
177 |
-
" fname = f\"vbow/nsvd/{folder}/{tfidf_dimension}/{svd_dimension}/embeddings.npy\"\n",
|
178 |
-
" embeddings = np.load(fname)\n",
|
179 |
-
" print(embeddings.shape)\n",
|
180 |
-
" # figs.append(make_2d_plot(embeddings, ))"
|
181 |
-
]
|
182 |
-
},
|
183 |
-
{
|
184 |
-
"cell_type": "code",
|
185 |
-
"execution_count": null,
|
186 |
-
"id": "c924d722-003d-4e90-84c5-148f5c3698ed",
|
187 |
-
"metadata": {},
|
188 |
-
"outputs": [],
|
189 |
-
"source": []
|
190 |
-
}
|
191 |
-
],
|
192 |
-
"metadata": {
|
193 |
-
"kernelspec": {
|
194 |
-
"display_name": "Python 3 (ipykernel)",
|
195 |
-
"language": "python",
|
196 |
-
"name": "python3"
|
197 |
-
},
|
198 |
-
"language_info": {
|
199 |
-
"codemirror_mode": {
|
200 |
-
"name": "ipython",
|
201 |
-
"version": 3
|
202 |
-
},
|
203 |
-
"file_extension": ".py",
|
204 |
-
"mimetype": "text/x-python",
|
205 |
-
"name": "python",
|
206 |
-
"nbconvert_exporter": "python",
|
207 |
-
"pygments_lexer": "ipython3",
|
208 |
-
"version": "3.9.5"
|
209 |
-
}
|
210 |
-
},
|
211 |
-
"nbformat": 4,
|
212 |
-
"nbformat_minor": 5
|
213 |
-
}
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56c86b7400996f041c0ac02efd12008989337bc3476634d68c2c19dd329cb17a
|
3 |
+
size 13631418
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|