Spaces:
Paused
Paused
Update app.py
Browse files45 unmodified lines4647484950515237 unmodified lines9091929394959645 unmodified linesreturn label_list, label_fractionsdef randomize_labels(examples, indices):# What set of examples should be randomized in this batch?# This is the intersection of the batch indices and the indices we randomly selected to change the labels of.batch_subset = list(set(indices) & randomize_subset)37 unmodified linesnew_random_labels = list(choice(a=label_list, size=num_new_labels, p=label_fractions))# Update the dataset so that the labels are randomizedupdated_dataset = dataset.map(randomize_labels, with_indices=True,features=dataset.features, batched=True)# Upload the new version of the dataset (this will take awhile)45 unmodified lines4647484950515237 unmodified lines909192939495969745 unmodified linesreturn label_list, label_fractionsdef randomize_labels(examples, indices, new_random_labels):# What set of examples should be randomized in this batch?# This is the intersection of the batch indices and the indices we randomly selected to change the labels of.batch_subset = list(set(indices) & randomize_subset)37 unmodified linesnew_random_labels = list(choice(a=label_list, size=num_new_labels, p=label_fractions))# Update the dataset so that the labels are randomizedupdated_dataset = dataset.map(randomize_labels, with_indices=True,fn_kwargs={'new_random_labels':new_random_labels},features=dataset.features, batched=True)# Upload the new version of the dataset (this will take awhile)
app.py+3-2