Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix dataset downloading errors #387

Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
26e5532
Create branch ci/fix-dataset-caching
akihironitta Nov 20, 2020
ec44147
Set LitMNIST tests datadir
akihironitta Nov 20, 2020
5d7c622
Disable doctest in the full tests
akihironitta Nov 20, 2020
d8d7706
Push an empty commit to rerun ci
akihironitta Nov 20, 2020
257a0db
miss
Borda Nov 22, 2020
faeebf2
Use ./datasets/ in the doctests
akihironitta Nov 26, 2020
6828ed8
ls datasets
akihironitta Nov 26, 2020
3c0ea22
ls datasets/*
akihironitta Nov 26, 2020
15fc3a2
ls for win?
akihironitta Nov 26, 2020
ec400ff
Apply suggestions from code review
Borda Nov 27, 2020
3c5acef
Apply suggestions from code review
Borda Nov 27, 2020
ece43be
skip
Borda Nov 27, 2020
d49d394
Update ci_test-full.yml
Borda Nov 27, 2020
47ae5ae
Update ci_test-full.yml
Borda Nov 27, 2020
4dc0102
make case insensitive
akihironitta Nov 27, 2020
1e75de5
rubbish into /dev/null
akihironitta Nov 27, 2020
e26dcc6
dont fail on "Check cached datasets"
akihironitta Nov 27, 2020
4de03ec
Revert 'dont fail on "Check cached datasets"'
akihironitta Nov 27, 2020
8084d9a
Update ci_test-full.yml
akihironitta Nov 27, 2020
4fcd604
dont fail on "Check cached datasets"
akihironitta Dec 3, 2020
064c25b
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
b031e5e
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
b08bd07
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
57ea44a
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
30a7f6d
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
03fdeab
Push an empty commit to rerun ci
akihironitta Dec 3, 2020
6809f60
Revert unrelated to this PR
akihironitta Dec 5, 2020
bcec793
Revert unrelated to this PR
akihironitta Dec 5, 2020
1936cb5
Push an empty commit to rerun ci
akihironitta Dec 5, 2020
8d39c65
Disable find
akihironitta Dec 5, 2020
0346211
Exit pytest on the first fail
akihironitta Dec 5, 2020
e4d7aba
Show data size in datasets
akihironitta Dec 5, 2020
308129c
Push an empty commit to rerun ci
akihironitta Dec 5, 2020
005db66
Push an empty commit to rerun ci
akihironitta Dec 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/ci_test-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,33 @@ jobs:
path: ./datasets
key: pl-datasets-${{ hashFiles('tests/conftest.py') }}

- name: Check cached datasets
shell: bash
run: |
ls -lh
echo =======
ls -lh datasets
echo =======
ls -lh datasets/*
Borda marked this conversation as resolved.
Show resolved Hide resolved

- name: Tests
run: |
# tox --sitepackages
coverage run --source pl_bolts -m py.test pl_bolts tests -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
coverage run --source pl_bolts -m pytest pl_bolts tests -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml
coverage xml

- name: Check cached datasets
shell: bash
run: |
ls -lh
echo =======
ls -lh datasets
echo =======
find . -name "MNIST"
find . -name "mnist"
find . -name "CIFAR"
find . -name "cifar"

- name: Upload pytest test results
uses: actions/upload-artifact@v2
with:
Expand Down
5 changes: 2 additions & 3 deletions pl_bolts/datasets/cifar10_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ class CIFAR10(LightDataset):
downloaded again.

Examples:

>>> from torchvision import transforms
>>> from pl_bolts.transforms.dataset_normalizations import cifar10_normalization
>>> cf10_transforms = transforms.Compose([transforms.ToTensor(), cifar10_normalization()])
>>> dataset = CIFAR10(download=True, transform=cf10_transforms)
>>> dataset = CIFAR10(download=True, transform=cf10_transforms, data_dir="datasets")
>>> len(dataset)
50000
>>> torch.bincount(dataset.targets)
Expand Down Expand Up @@ -167,7 +166,7 @@ class TrialCIFAR10(CIFAR10):
without the torchvision dependency.
Examples:

>>> dataset = TrialCIFAR10(download=True, num_samples=150, labels=(1, 5, 8))
>>> dataset = TrialCIFAR10(download=True, num_samples=150, labels=(1, 5, 8), data_dir="datasets")
>>> len(dataset)
450
>>> sorted(set([d.item() for d in dataset.targets]))
Expand Down
12 changes: 6 additions & 6 deletions tests/callbacks/test_data_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
)
@mock.patch("pl_bolts.callbacks.data_monitor.DataMonitorBase.log_histogram")
def test_base_log_interval_override(
log_histogram, tmpdir, log_every_n_steps, max_steps, expected_calls
log_histogram, tmpdir, log_every_n_steps, max_steps, expected_calls, datadir
):
""" Test logging interval set by log_every_n_steps argument. """
monitor = TrainingDataMonitor(log_every_n_steps=log_every_n_steps)
model = LitMNIST(num_workers=0)
model = LitMNIST(data_dir=datadir, num_workers=0)
trainer = Trainer(
default_root_dir=tmpdir,
log_every_n_steps=1,
Expand All @@ -43,11 +43,11 @@ def test_base_log_interval_override(
)
@mock.patch("pl_bolts.callbacks.data_monitor.DataMonitorBase.log_histogram")
def test_base_log_interval_fallback(
log_histogram, tmpdir, log_every_n_steps, max_steps, expected_calls
log_histogram, tmpdir, log_every_n_steps, max_steps, expected_calls, datadir
):
""" Test that if log_every_n_steps not set in the callback, fallback to what is defined in the Trainer. """
monitor = TrainingDataMonitor()
model = LitMNIST(num_workers=0)
model = LitMNIST(data_dir=datadir, num_workers=0)
trainer = Trainer(
default_root_dir=tmpdir,
log_every_n_steps=log_every_n_steps,
Expand Down Expand Up @@ -81,10 +81,10 @@ def test_base_unsupported_logger_warning(tmpdir):


@mock.patch("pl_bolts.callbacks.data_monitor.TrainingDataMonitor.log_histogram")
def test_training_data_monitor(log_histogram, tmpdir):
def test_training_data_monitor(log_histogram, tmpdir, datadir):
""" Test that the TrainingDataMonitor logs histograms of data points going into training_step. """
monitor = TrainingDataMonitor()
model = LitMNIST()
model = LitMNIST(data_dir=datadir, num_workers=0)
trainer = Trainer(
default_root_dir=tmpdir, log_every_n_steps=1, callbacks=[monitor],
)
Expand Down