Spaces:
Paused
Paused
Update app.py
Browse files45 unmodified lines464748494950515237 unmodified lines90919293939495969745 unmodified lines return label_list, label_fractions
def randomize_labels(examples, indices):def 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 lines new_random_labels = list(choice(a=label_list, size=num_new_labels, p=label_fractions))
# Update the dataset so that the labels are randomized updated_dataset = dataset.map(randomize_labels, with_indices=True, updated_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