Skip to content

Commit

Permalink
Merge branch 'intel' of github.com:mila-iqia/milabench into intel
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre.delaunay committed May 31, 2024
2 parents 0f23900 + a7d94cc commit f8749d6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions benchmarks/torchvision/prepare.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import argparse
from collection import defaultdict
from collections import defaultdict
import multiprocessing
import os
from pathlib import Path
Expand Down Expand Up @@ -48,13 +48,10 @@ def generate(image_size, n, outdir, start = 0):


def count_images(path):
count = defaultdict(0)
count = defaultdict(int)
for root, _, files in tqdm(os.walk(path)):
try:
_, split, _ = root.split('/')
count[split] += len(files)
except:
pass
split = root.split('/')[-2]
count[split] += len(files)

return count

Expand All @@ -71,7 +68,7 @@ def generate_sets(root, sets, shape):

if current_count < count:
print(f"Generating {split} (current {current_count}) (target: {count})")
generate(shape, count, os.path.join(root, split), start=current_count)
generate(shape, count - current_count, os.path.join(root, split), start=current_count)

with open(sentinel, "w") as fp:
json.dump(sets, fp)
Expand Down

0 comments on commit f8749d6

Please sign in to comment.