Skip to content

Commit 5065267

Browse files
committed
Including the docker file
1 parent 05a2c0e commit 5065267

File tree

7 files changed

+125
-110
lines changed

7 files changed

+125
-110
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525

2626
- name: Run tests
2727
run: |
28-
PYTHONPATH=. pytest tests
28+
PYTHONPATH=. pytest 4
2929
shell: bash -el {0}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ wandb/*
99
wandb_api.py
1010

1111
#Magnus specific
12-
docker/*
1312
job*
1413
env2/*
1514
ruffian.sh
15+
localtest.sh
1616

1717
# Byte-compiled / optimized / DLL files
1818
__pycache__/

docker/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM pytorch/pytorch:2.4.1-cuda11.8-cudnn9-runtime
2+
WORKDIR /tmp/
3+
COPY requirements.txt .
4+
RUN apt-get update
5+
RUN pip install -r requirements.txt
6+
RUN apt-get install ffmpeg libsm6 libxext6 -y git
7+
RUN pip install ftfy regex tqdm

docker/createdocker.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
sudo chmod 666 /var/run/docker.sock
4+
5+
docker build docker -t seilmast/colabexam:latest
6+
docker push seilmast/colabexam:latest

docker/requirements.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
annotated-types==0.7.0
2+
asttokens==3.0.0
3+
certifi==2024.12.14
4+
charset-normalizer==3.4.1
5+
click==8.1.8
6+
comm==0.2.2
7+
debugpy==1.8.12
8+
decorator==5.1.1
9+
docker-pycreds==0.4.0
10+
executing==2.2.0
11+
filelock==3.13.1
12+
fsspec==2024.6.1
13+
gitdb==4.0.12
14+
GitPython==3.1.44
15+
h5py==3.12.1
16+
idna==3.10
17+
iniconfig==2.0.0
18+
ipykernel==6.29.5
19+
ipython==8.31.0
20+
jedi==0.19.2
21+
Jinja2==3.1.4
22+
jupyter_client==8.6.3
23+
jupyter_core==5.7.2
24+
MarkupSafe==2.1.5
25+
matplotlib-inline==0.1.7
26+
mpmath==1.3.0
27+
nest-asyncio==1.6.0
28+
networkx==3.3
29+
numpy==2.1.2
30+
packaging==24.2
31+
parso==0.8.4
32+
pexpect==4.9.0
33+
pillow==11.0.0
34+
platformdirs==4.3.6
35+
pluggy==1.5.0
36+
prompt_toolkit==3.0.50
37+
protobuf==5.29.3
38+
psutil==6.1.1
39+
ptyprocess==0.7.0
40+
pure_eval==0.2.3
41+
pydantic==2.10.6
42+
pydantic_core==2.27.2
43+
Pygments==2.19.1
44+
pytest==8.3.4
45+
python-dateutil==2.9.0.post0
46+
PyYAML==6.0.2
47+
pyzmq==26.2.1
48+
requests==2.32.3
49+
scipy==1.15.1
50+
sentry-sdk==2.20.0
51+
setproctitle==1.3.4
52+
six==1.17.0
53+
smmap==5.0.2
54+
stack-data==0.6.3
55+
sympy==1.13.1
56+
tornado==6.4.2
57+
traitlets==5.14.3
58+
typing_extensions==4.12.2
59+
urllib3==2.3.0
60+
wandb==0.19.5
61+
wcwidth==0.2.13

tests/test_dataloaders.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/test_wrappers.py

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
from utils import load_data, load_metric, load_model
22

3+
# def test_load_model():
4+
# import torch as th
35

4-
def test_load_model():
5-
import torch as th
6+
# image_shape = (1, 16, 16)
7+
# num_classes = 4
68

7-
image_shape = (1, 28, 28)
8-
num_classes = 4
9+
# dummy_img = th.rand((1, *image_shape))
910

10-
dummy_img = th.rand((1, *image_shape))
11+
# modelnames = [
12+
# "magnusmodel",
13+
# "christianmodel",
14+
# "janmodel",
15+
# "solveigmodel",
16+
# "johanmodel",
17+
# ]
1118

12-
modelnames = [
13-
"magnusmodel",
14-
"christianmodel",
15-
"janmodel",
16-
"solveigmodel",
17-
"johanmodel",
18-
]
19+
# for name in modelnames:
20+
# print(name)
21+
# model = load_model(name, image_shape=image_shape, num_classes=num_classes)
1922

20-
for name in modelnames:
21-
model = load_model(name, image_shape=image_shape, num_classes=num_classes)
23+
# with th.no_grad():
24+
# output = model(dummy_img)
25+
# assert output.size() == (1, 4), (
26+
# f"Model {name} returned image of size {output}. Expected (1,4)"
27+
# )
2228

23-
with th.no_grad():
24-
output = model(dummy_img)
25-
assert output.size() == (1, 4), (
26-
f"Model {name} returned image of size {output}. Expected (1,4)"
27-
)
2829

30+
def test_load_data():
31+
from tempfile import TemporaryDirectory
2932

30-
# def test_load_data():
31-
# from tempfile import TemporaryDirectory
33+
import torch as th
34+
from torchvision import transforms
35+
36+
dataset_names = [
37+
"usps_0-6",
38+
"mnist_0-3",
39+
"usps_7-9",
40+
"svhn",
41+
# 'mnist_4-9' #Uncomment when implemented
42+
]
3243

33-
# import torch as th
34-
# from torchvision import transforms
35-
36-
# dataset_names = [
37-
# "usps_0-6",
38-
# "mnist_0-3",
39-
# "usps_7-9",
40-
# "svhn",
41-
# # 'mnist_4-9' #Uncomment when implemented
42-
# ]
44+
trans = transforms.Compose(
45+
[
46+
transforms.Resize((16, 16)),
47+
transforms.ToTensor(),
48+
]
49+
)
50+
51+
with TemporaryDirectory() as tmppath:
52+
for name in dataset_names:
53+
dataset = load_data(
54+
name, train=False, data_path=tmppath, download=True, transform=trans
55+
)
4356

44-
# trans = transforms.Compose(
45-
# [
46-
# transforms.Resize((16, 16)),
47-
# transforms.ToTensor(),
48-
# ]
49-
# )
50-
51-
# with TemporaryDirectory() as tmppath:
52-
# for name in dataset_names:
53-
# dataset = load_data(
54-
# name, train=False, data_path=tmppath, download=True, transform=trans
55-
# )
57+
im, _ = dataset.__getitem__(0)
5658

57-
# im, lab = dataset.__getitem__(0)
59+
assert dataset.__len__() != 0
60+
assert type(im) == th.Tensor and len(im.size()) == 3
5861

59-
# assert dataset.__len__() != 0
60-
# assert type(im) == th.Tensor and len(im.size()) == 3
61-
# assert lab - lab == 0.0
6262

63-
# def test_load_metric():
64-
# pass
63+
def test_load_metric():
64+
pass

0 commit comments

Comments
 (0)