evalmerge / domainnet /lower_train.py
yashkant's picture
Upload domainnet/lower_train.py with huggingface_hub
fe6a4ad verified
import random
import ipdb
domains = ["clipart", "infograph", "painting", "quickdraw", "real", "sketch"]
random.seed(42)
data = []
for index, domain in enumerate(domains):
with open(domain + '_train_fold.txt', 'r') as f:
domain_data = f.readlines()
domain_data = [x.strip() + ' ' + str(index) + '\n' for x in domain_data]
data.extend(domain_data)
random.shuffle(data)
data = data[:30000]
with open('Domainnet_train_30k.txt', 'w') as f:
f.write("".join(data))