Image classifier test
Example showing how the test suite can be used to add tests for a new algorithm.
TestImageClassifier #
Bases: LightningModuleTests[ImageClassifier]
Tests for the ImageClassifier.
This runs all the tests included in the base class, with the given parametrizations:
algorithm_configwill take the value"image_classifier"- This is because there is an
image_classifier.yamlconfig file in project/configs/algorithms whose_target_is theImageClassifier.
- This is because there is an
datamodule_configwill take these values:['cifar10', 'fashion_mnist', 'imagenet', 'inaturalist', 'mnist']- These are all the configs whose target is an
ImageClassificationDataModule.
- These are all the configs whose target is an
- Similarly,
network_configwill be parametrized by the names of all configs which produce an nn.Module, except those that would create aPreTrainedModelfrom HuggingFace.- This is currently the easiest way for us to say "any network for image classification.
Take a look at the LightningModuleTests class if you want to see the actual test code.