Skip to content

Commit 15e58bc

Browse files
committed
fix: remove torchvision and resnet, replace with larger model
- Remove torchvision dependency and stop using resnet model - Add neural network from PyTorch quickstart tutorial for e2e test
1 parent d7a5f9b commit 15e58bc

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

.github/workflows/python-integration.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ jobs:
131131
if: matrix.runner != 'macos-13'
132132
run: |
133133
python -m pip install './s3torchconnector[dcp-test]'
134-
python -m pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
135134
- name: Run s3torchconnector DCP e2e tests
136135
if: matrix.runner != 'macos-13'
137136
run: |

s3torchconnector/tst/e2e/dcp/test_e2e_s3_storage_reader.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,41 @@
55
from unittest.mock import patch
66

77
import torch
8+
import torch.nn as nn
89
import torch.distributed.checkpoint as dcp
9-
import torchvision.models as models
1010

1111
from s3torchconnector import S3ReaderConstructor
1212
from s3torchconnector.dcp import S3StorageWriter, S3StorageReader
1313
from s3torchconnector.s3reader.sequential import SequentialS3Reader
1414

1515

16-
@pytest.mark.parametrize(
17-
"model",
18-
[
19-
torch.nn.Sequential(
20-
torch.nn.Linear(5, 5),
21-
torch.nn.Linear(20, 20),
22-
torch.nn.Linear(10, 10),
23-
),
24-
models.resnet18(pretrained=False),
25-
],
16+
SIMPLE_MODEL = torch.nn.Sequential(
17+
nn.Linear(5, 5),
18+
nn.Linear(20, 20),
19+
nn.Linear(10, 10),
2620
)
27-
def test_prepare_local_plan_sorts_by_storage_offset(checkpoint_directory, model):
21+
22+
23+
class NeuralNetwork(nn.Module):
24+
"""NeuralNetwork from PyTorch quickstart tutorial."""
25+
26+
def __init__(self):
27+
super().__init__()
28+
self.flatten = nn.Flatten()
29+
self.linear_relu_stack = nn.Sequential(
30+
nn.Linear(28 * 28, 512),
31+
nn.ReLU(),
32+
nn.Linear(512, 512),
33+
nn.ReLU(),
34+
nn.Linear(512, 10),
35+
)
36+
37+
38+
LARGER_MODEL = NeuralNetwork()
39+
40+
41+
@pytest.mark.parametrize("model", [SIMPLE_MODEL, LARGER_MODEL])
42+
def test_dcp_load_reads_tensors_in_sequential_order(checkpoint_directory, model):
2843
"""
2944
Test that prepare_local_plan allows dcp.load() to read items in offset order.
3045

0 commit comments

Comments
 (0)