Now you've implemented your task, it's time to add an example showing how cool it is! We usually provide one example in flash_examples/. You can base these off of our template.py
examples.
The example should:
- download the data (we'll add the example to our CI later on, so choose a dataset small enough that it runs in reasonable time)
- load the data into a
~flash.core.data.data_module.DataModule
- create an instance of the
~flash.core.model.Task
- create a
~flash.core.trainer.Trainer
- call
~flash.core.trainer.Trainer.finetune
or~flash.core.trainer.Trainer.fit
to train your model - generate predictions for a few examples
- save the checkpoint
For our template example we don't have a pretrained backbone, so we can just call ~flash.core.trainer.Trainer.fit
rather than ~flash.core.trainer.Trainer.finetune
. Here's the full example (flash_examples/template.py):
../../../flash_examples/template.py
We get this output:
['setosa', 'virginica', 'versicolor']
Now that you've got an example showing your awesome task in action, it's time to write some tests! <contributing_tests>