Skip to content

Commit

Permalink
Merge branch 'main' into add-vit-swag-huge
Browse files Browse the repository at this point in the history
  • Loading branch information
YosuaMichael authored Apr 4, 2022
2 parents dd21912 + 3130b45 commit e4062f4
Show file tree
Hide file tree
Showing 9 changed files with 452 additions and 86 deletions.
136 changes: 68 additions & 68 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .circleci/regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build_workflows(prefix="", filter_branch=None, upload=False, indentation=6,
for os_type in ["linux", "macos", "win"]:
python_versions = PYTHON_VERSIONS
cu_versions_dict = {
"linux": ["cpu", "cu102", "cu113", "cu115", "rocm4.3.1", "rocm4.5.2"],
"linux": ["cpu", "cu102", "cu113", "cu115", "rocm4.5.2", "rocm5.0"],
"win": ["cpu", "cu113", "cu115"],
"macos": ["cpu"],
}
Expand Down
38 changes: 38 additions & 0 deletions test/builtin_dataset_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,44 @@ def country211(info, root, config):
return num_examples * len(classes)


@register_mock
def food101(info, root, config):
data_folder = root / "food-101"

num_images_per_class = 3
image_folder = data_folder / "images"
categories = ["apple_pie", "baby_back_ribs", "waffles"]
image_ids = []
for category in categories:
image_files = create_image_folder(
image_folder,
category,
file_name_fn=lambda idx: f"{idx:04d}.jpg",
num_examples=num_images_per_class,
)
image_ids.extend(path.relative_to(path.parents[1]).with_suffix("").as_posix() for path in image_files)

meta_folder = data_folder / "meta"
meta_folder.mkdir()

with open(meta_folder / "classes.txt", "w") as file:
for category in categories:
file.write(f"{category}\n")

splits = ["train", "test"]
num_samples_map = {}
for offset, split in enumerate(splits):
image_ids_in_split = image_ids[offset :: len(splits)]
num_samples_map[split] = len(image_ids_in_split)
with open(meta_folder / f"{split}.txt", "w") as file:
for image_id in image_ids_in_split:
file.write(f"{image_id}\n")

make_tar(root, f"{data_folder.name}.tar.gz", compression="gz")

return num_samples_map[config.split]


@register_mock
def dtd(info, root, config):
data_folder = root / "dtd"
Expand Down
Loading

0 comments on commit e4062f4

Please sign in to comment.