Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def main(percentage=10):
|
|
32 |
# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.
|
33 |
# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.
|
34 |
dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,
|
35 |
-
trust_remote_code=True, token=GATED_IMAGENET)
|
36 |
|
37 |
# Create a set of indices that are randomly chosen, to change their labels.
|
38 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|
@@ -45,7 +45,7 @@ def main(percentage=10):
|
|
45 |
|
46 |
# Upload the new version of the dataset (this will take awhile)
|
47 |
Dataset.from_generator(updated_dataset.__iter__).push_to_hub(
|
48 |
-
"datacomp/imagenet-1k-random" + str(percentage), token=GATED_IMAGENET)
|
49 |
|
50 |
end = time.time()
|
51 |
print("That took %d seconds" % (end - start))
|
|
|
32 |
# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.
|
33 |
# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.
|
34 |
dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,
|
35 |
+
trust_remote_code=True, token=GATED_IMAGENET, columns=["label"]).take(DEV_AMOUNT)
|
36 |
|
37 |
# Create a set of indices that are randomly chosen, to change their labels.
|
38 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|
|
|
45 |
|
46 |
# Upload the new version of the dataset (this will take awhile)
|
47 |
Dataset.from_generator(updated_dataset.__iter__).push_to_hub(
|
48 |
+
"datacomp/imagenet-1k-random-debug" + str(percentage), token=GATED_IMAGENET)
|
49 |
|
50 |
end = time.time()
|
51 |
print("That took %d seconds" % (end - start))
|