Skip to content

Commit 09a856f

Browse files
authored
Staging (#367)
* Update sharedsetup to handle tar archive * Update docker container generation to handle UV correctly * Tweak dashboard utilities
1 parent c6cecc2 commit 09a856f

File tree

17 files changed

+1473
-138
lines changed

17 files changed

+1473
-138
lines changed

benchmarks/dinov2/prepare.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def loop_on(iterable:list):
3737
device=None,
3838
image_size=[3, 384, 384],
3939
val=0.1,
40-
test=0.1
40+
test=0.1,
41+
output=os.getenv("MILABENCH_DIR_DATA", None),
4142
)
4243
#
4344
generate_fakeimagenet(args)

benchmate/benchmate/datagen.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import os
77
from collections import defaultdict
88
from pathlib import Path
9+
import time
10+
import random
911

1012
import torchcompat.core as acc
1113
import torch
@@ -17,11 +19,18 @@ def write(args):
1719

1820
offset, outdir, prefix, size = args
1921

20-
img = torch.randn(*size)
21-
target = offset % 1000 # torch.randint(0, 1000, size=(1,), dtype=torch.long)[0]
22+
seed = int(time.time() + offset)
23+
24+
torch.manual_seed(seed)
25+
random.seed(seed)
26+
27+
img = torch.randint(0, 256, size, dtype=torch.uint8)
28+
# img = torch.randn(*size)
29+
2230
img = transforms.ToPILImage()(img)
31+
target = offset % 1000 # torch.randint(0, 1000, size=(1,), dtype=torch.long)[0]
2332
class_val = int(target)
24-
33+
2534
# Some benches need filenames to match those of imagenet:
2635
# https://github.com/facebookresearch/dinov2/blob/e1277af2ba9496fbadf7aec6eba56e8d882d1e35/dinov2/data/datasets/image_net.py#L40-L43
2736
if not prefix: # train
@@ -110,6 +119,7 @@ def fakeimagenet_args():
110119
parser.add_argument("--image-size", default=[3, 384, 384], type=int, nargs="+")
111120
parser.add_argument("--val", default=0.1, type=float, nargs="+")
112121
parser.add_argument("--test", default=0.1, type=float, nargs="+")
122+
parser.add_argument("--output", default=os.getenv("MILABENCH_DIR_DATA", None), type=str)
113123
args, _ = parser.parse_known_args()
114124
return args
115125

@@ -124,7 +134,8 @@ def generate_fakeimagenet(args=None):
124134
bs, bc = overrides.split(",")
125135
args.batch_size, args.batch_count = int(bs), int(bc)
126136

127-
data_directory = os.environ["MILABENCH_DIR_DATA"]
137+
assert args.output is not None, "Output directory is required"
138+
data_directory = args.output
128139

129140
dest = os.path.join(data_directory, f"FakeImageNet")
130141
print(f"Generating fake data into {dest}...")

config/slurm.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,18 @@ single-node-full-A100l:
5050
- --export=ALL
5151
- -w cn-d[003-004]
5252
single-node-full-L40S:
53-
- -w cn-l[001-091]
54-
- --ntasks=1
55-
- --gpus-per-task=4
56-
- --exclusive
53+
- --job-name=run_l40s
54+
- --partition=staff-idt
5755
- --nodes=1
56+
- --ntasks=1
5857
- --cpus-per-task=48
59-
- --time=1:30:00
60-
- --ntasks-per-node=1
6158
- --mem=0
59+
- --time=4:30:00
60+
- --gpus-per-task=4
61+
- --ntasks-per-node=1
62+
- --exclusive
6263
- --export=ALL,MILABENCH_SIZER_AUTO=0
64+
- -w cn-l[001-092]
6365
single-node-small:
6466
- --partition=staff-idt
6567
- --ntasks=1
@@ -172,3 +174,14 @@ run_shared_install_prepare:
172174
- --gpus-per-task=1
173175
- --ntasks-per-node=1
174176
- --export=ALL
177+
tar_prepare:
178+
- --job-name=tar
179+
- --partition=staff-idt
180+
- --nodes=1
181+
- --ntasks=1
182+
- --cpus-per-task=2
183+
- --mem=16G
184+
- --time=06:00:00
185+
- --gpus-per-task=0
186+
- --ntasks-per-node=1
187+
- --export=ALL

docker/Dockerfile-cuda

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# FROM ubuntu:22.04
22

3-
# For cuda-gdb
4-
FROM nvidia/cuda:12.9.1-devel-ubuntu24.04
3+
FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04
4+
55

66
# Arguments
77
# ---------
@@ -59,11 +59,12 @@ ENV CUDA_HOME=/usr/local/cuda-12/
5959

6060
ENV MILAENCH_ENV=/milabench/.env
6161

62-
RUN virtualenv $MILAENCH_ENV &&\
62+
RUN RUN curl -LsSf https://astral.sh/uv/install.sh | sh &&\
63+
virtualenv $MILAENCH_ENV &&\
6364
$MILAENCH_ENV/bin/python -m pip install -U pip &&\
6465
$MILAENCH_ENV/bin/python -m pip install -U setuptools &&\
6566
$MILAENCH_ENV/bin/python -m pip install -U poetry &&\
66-
$MILAENCH_ENV/bin/python -m pip install -e /milabench/milabench/ &&\
67+
$MILAENCH_ENV/bin/python -m pip install -e /milabench/milabench[cuda] &&\
6768
$MILAENCH_ENV/bin/python -m pip cache purge
6869

6970
# Prepare bench

0 commit comments

Comments
 (0)