metadata
language:
- en
license: apache-2.0
download with
huggingface-cli download Yuanzhi/aesthetics_prompts_laion --repo-type=dataset --local-dir aesthetics
Aesthetic6+, Aesthetic6.25+ & Aesthetic6.5+ prompts dataset for SiD-LSG training.
Filtered from dclure/laion-aesthetics-12m-umap.
All credits to the authors of SiD.
from datasets import load_dataset
import os
dataset_dir = 'aesthetics'
# ds = load_dataset("parquet", data_dir=dataset_dir, split='train')
ds = load_dataset("aesthetics", data_files='train.parquet')
# ds = load_dataset(dataset_dir, data_files='train.parquet')
six_two_five_plus = []
six_five_plus = []
six_plus = []
ds = ds['train']
total = len(ds)
print(f'total {total} records need to be scanned')
percent = int(total / 100)
i = 0
for entry in ds:
six_plus.append(entry['TEXT'])
if entry['AESTHETIC_SCORE'] >= 6.25:
six_two_five_plus.append(entry['TEXT'])
if entry['AESTHETIC_SCORE'] >= 6.5:
six_five_plus.append(entry['TEXT'])
i += 1
if i % percent == 0:
print(f'scanned {i / percent}% data')
print(f'got {len(six_plus)} 6.0+, {len(six_two_five_plus)} 6.25+ and {len(six_five_plus)} 6.5+')
percent = int(len(six_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_6_plus.txt'), 'wt') as f:
for row in six_plus:
i += 1
f.write(row + '\n')
if i % percent == 0:
print(f'generated {i / percent}% 6.0+ data to text file')
print(f'Generated {len(six_plus)} prompts for 6.0+ score')
percent = int(len(six_two_five_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_625_plus.txt'), 'wt') as f:
for row in six_two_five_plus:
i += 1
f.write(row + '\n')
if i % percent == 0:
print(f'generated {i / percent}% 6.25+ data to text file')
print(f'Generated {len(six_two_five_plus)} prompts for 6.25+ score')
percent = int(len(six_five_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_65_plus.txt'), 'wt') as f:
for row in six_five_plus:
i += 1
f.write(row + '\n')
if i % percent == 0:
print(f'generated {i / percent}% 6.5+ data to text file')
print(f'Generated {len(six_five_plus)} prompts for 6.5+ score')