This PR allows import mart with the "core" dependency group alone. In this way, a non-image domain user does not need to install torchvision etc.
$ pip install -e .[core,developer]
$ python
Python 3.9.19 (main, May 9 2024, 16:03:05)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mart
fiftyone is not installed, so some features in MART are unavailable.
torchvision is not installed, so some features in MART are unavailable.
timm is not installed, so some features in MART are unavailable.
pycocotools is not installed, so some features in MART are unavailable.
>>>
pytest automatically skips related tests if dependency is not available locally.
$ pytest
...
tests/test_utils.py::test_flatten_dict_key_collision PASSED [100%]
================================ slowest durations ================================
0.23s call tests/test_adversary.py::test_forward_with_model
0.03s call tests/test_adversary_connector.py::test_adversary_connector_callback
0.03s setup tests/test_adversary.py::test_with_model
0.01s call tests/test_adversary.py::test_with_model
(351 durations < 0.005s hidden. Use -vv to show these durations.)
========================= 113 passed, 10 skipped in 0.71s =========================
Type of change
Please check all relevant options.
[x] Improvement (non-breaking)
[ ] Bug fix (non-breaking)
[ ] New feature (non-breaking)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update
Testing
Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.
What does this PR do?
This PR allows
import mart
with the "core" dependency group alone. In this way, a non-image domain user does not need to installtorchvision
etc.pytest
automatically skips related tests if dependency is not available locally.Type of change
Please check all relevant options.
Testing
Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.
pytest
CUDA_VISIBLE_DEVICES=0 python -m mart experiment=CIFAR10_CNN_Adv trainer=gpu trainer.precision=16
reports 70% (21 sec/epoch).CUDA_VISIBLE_DEVICES=0,1 python -m mart experiment=CIFAR10_CNN_Adv trainer=ddp trainer.precision=16 trainer.devices=2 model.optimizer.lr=0.2 trainer.max_steps=2925 datamodule.ims_per_batch=256 datamodule.world_size=2
reports 70% (14 sec/epoch).Before submitting
pre-commit run -a
command without errorsDid you have fun?
Make sure you had fun coding 🙃