Spaces:
Paused
Paused
Update app.py
Browse files2 unmodified lines345667891022 unmodified lines33343535363738392 unmodified linesimport randomimport timefrom datasets import load_dataset, Dataset
from PIL import PngImagePluginPngImagePlugin.MAX_TEXT_CHUNK = 1048576 * 10 # this is the current value"""This code is designed to read in the ImageNet 1K ILSVRC dataset from the Hugging Face Hub, then create a new version of this dataset with {percentage} lines with random labels between 0-9,22 unmodified lines # Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once. # Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with. dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True, trust_remote_code=True, token=GATED_IMAGENET, columns=["label"]).take(DEV_AMOUNT) trust_remote_code=True, token=GATED_IMAGENET).take(DEV_AMOUNT)
# Create a set of indices that are randomly chosen, to change their labels. # Specifically, randomly choose NUM_EXAMPLES/percentage indices.app.py+3-2