File size: 4,014 Bytes
6639f79 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "a1e51cab",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ea3ea81741954384b0b6ee0e2d5f8b43",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"README.md: 0%| | 0.00/670 [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "16a23106959d4f4b870ac50ada254f73",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"data/train-00000-of-00004.parquet: 0%| | 0.00/503M [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a264fbf783704be8a18f62e7c352b1e7",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"data/train-00001-of-00004.parquet: 0%| | 0.00/503M [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ecdb1976f88f44c3aa5aef51508643e1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"data/train-00002-of-00004.parquet: 0%| | 0.00/477M [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "451d70b2799b4312b66d3d5a9d993726",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"data/train-00003-of-00004.parquet: 0%| | 0.00/497M [00:00<?, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d93865e127a14f4a9179f3b86caa0cfe",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Generating train split: 0%| | 0/1200 [00:00<?, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from datasets import load_dataset\n",
"\n",
"# Login using e.g. `huggingface-cli login` to access this dataset\n",
"ds = load_dataset(\"weathon/nag_dataset\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ab34f490",
"metadata": {},
"outputs": [],
"source": [
"base = [{\n",
" \"prompt\": \"A cat with weird colors is sitting on the table, looking at the TV. The whole image has clashing colors.\",\n",
" \"missing_element\": \"nature colors\"\n",
" },]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "74c7ee35",
"metadata": {},
"outputs": [],
"source": [
"for sample in ds[\"train\"]:\n",
" prompt = sample[\"prompt\"]\n",
" missing_element = sample[\"negative_prompt\"]\n",
" base.append({\n",
" \"prompt\": prompt,\n",
" \"missing_element\": missing_element\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c1aec56c",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"with open(\"anti_aesthetics.json\", \"w\") as f:\n",
" json.dump(base, f, indent=4)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "neg",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.17"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|