Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Flash CLI and Flash Zero (#611)
Browse files Browse the repository at this point in the history
* Use the LightningCLI in the image classification example

* FlashCLI

* Finetune support

* Port LightningCLI

* Update requirements

* Initial commit

* Updates

* Updates

* Updates

* Temp fill reqs

* Bump PL req

* Test

* Update

* Update

* Remove debug code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updates

* Add speech recognition

* Add text classification

* Add tabular and seq2seq

* Remove extra reqs

* Fix test

* Add pointcloud

* Add graph

* Fix test

* A fix

* Try fix

* Try fix

* Try fix

* Add tests

* Add click CLI

* Add click CLI

* Add some docs

* Update docs

* Punctuation

* Add some tests

* Update CHANGELOG.md

* Fix test

* Add some tests

* Test

* Updates

* Try fix

Co-authored-by: Carlos Mocholi <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 4, 2021
1 parent f9d3348 commit 8e42d39
Show file tree
Hide file tree
Showing 78 changed files with 3,101 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,5 @@ jigsaw_toxic_comments
flash_examples/serve/tabular_classification/data
logs/cache/*
flash_examples/data
flash_examples/cli/*/data
timit/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Added a `SpeechRecognition` task for speech to text using Wav2Vec ([#586](https://github.com/PyTorchLightning/lightning-flash/pull/586))

- Added Flash Zero, a zero code command line ML platform built with flash ([#611](https://github.com/PyTorchLightning/lightning-flash/pull/611))

### Changed

- Changed how pretrained flag works for loading weights for ImageClassifier task ([#560](https://github.com/PyTorchLightning/lightning-flash/pull/560))
Expand All @@ -46,6 +48,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Fixed a bug where an uncaught ValueError could be raised when checking if a module is available ([#615](https://github.com/PyTorchLightning/lightning-flash/pull/615))

- Fixed a bug where some tasks were not compatible with PyTorch 1.7 due to use of `torch.jit.isinstance` ([#611](https://github.com/PyTorchLightning/lightning-flash/pull/611))

## [0.4.0] - 2021-06-22

### Added
Expand Down
56 changes: 56 additions & 0 deletions docs/source/general/flash_zero.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _flash_zero:

**********
Flash Zero
**********

Flash Zero is a zero-code machine learning platform built directly into lightning-flash.
To get started and view the available tasks, run:

.. code-block:: bash
flash --help
Customize Trainer and Model arguments
_____________________________________

Flash Zero is built on top of the
`lightning CLI <https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_cli.html>`_, so the trainer and
model arguments can be configured either from the command line or from a config file.
For example, to run the image classifier for 10 epochs with a `resnet50` backbone you can use:

.. code-block:: bash
flash image-classification --trainer.max_epochs 10 --model.backbone resnet50
To view all of the available options for a task, run:

.. code-block:: bash
flash image-classification --help
Using Custom Data
_________________

Flash Zero works with your own data through subcommands. The available subcommands for each task are given at the bottom
of their help pages (e.g. when running :code:`flash image-classification --help`). You can then use the required
subcommand to train on your own data. Let's look at an example using the Hymenoptera data from the
:ref:`image_classification` guide. First, download and unzip your data:

.. code-block:: bash
curl https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip -o hymenoptera_data
unzip hymenoptera_data.zip
Now train with Flash Zero:

.. code-block:: bash
flash image-classification from_folders --train_folder ./hymenoptera_data/train
You can view the help page for each subcommand. For example, to view the options for training an image classifier from
folders, you can run:

.. code-block:: bash
flash image-classification from_folders --help
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Lightning Flash
general/jit
general/data
general/registry
general/flash_zero
general/serve

.. toctree::
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/audio_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,22 @@ Here's the full example:
.. literalinclude:: ../../../flash_examples/audio_classification.py
:language: python
:lines: 14-

------

**********
Flash Zero
**********

The audio classifier can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash audio-classification
To view configuration options and options for running the audio classifier with your own data, use:

.. code-block:: bash
flash audio-classification --help
19 changes: 19 additions & 0 deletions docs/source/reference/graph_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,22 @@ Here's the full example:
.. literalinclude:: ../../../flash_examples/graph_classification.py
:language: python
:lines: 14-

------

**********
Flash Zero
**********

The graph classifier can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash graph-classifier
To view configuration options and options for running the graph classifier with your own data, use:

.. code-block:: bash
flash graph-classifier --help
19 changes: 19 additions & 0 deletions docs/source/reference/image_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ Here's the full example:

------

**********
Flash Zero
**********

The image classifier can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the hymenoptera example with:

.. code-block:: bash
flash image-classification
To view configuration options and options for running the image classifier with your own data, use:

.. code-block:: bash
flash image-classification --help
------

*******
Serving
*******
Expand Down
21 changes: 21 additions & 0 deletions docs/source/reference/image_classification_multi_label.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,27 @@ Here's the full example:
:language: python
:lines: 14-


------

**********
Flash Zero
**********

The multi-label image classifier can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the movie posters example with:

.. code-block:: bash
flash image-classification from_movie_posters
To view configuration options and options for running the image classifier with your own data, use:

.. code-block:: bash
flash image-classification --help
------

*******
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/object_detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,22 @@ Here's the full example:
.. literalinclude:: ../../../flash_examples/object_detection.py
:language: python
:lines: 14-

------

**********
Flash Zero
**********

The object detector can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash object-detection
To view configuration options and options for running the object detector with your own data, use:

.. code-block:: bash
flash object-detection --help
21 changes: 19 additions & 2 deletions docs/source/reference/pointcloud_object_detection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,24 @@ Here's the full example:
:language: python
:lines: 14-



.. image:: https://raw.githubusercontent.com/intel-isl/Open3D-ML/master/docs/images/visualizer_BoundingBoxes.png
:width: 100%

------

**********
Flash Zero
**********

The point cloud object detector can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash pointcloud-detection
To view configuration options and options for running the point cloud object detector with your own data, use:

.. code-block:: bash
flash pointcloud-detection --help
21 changes: 19 additions & 2 deletions docs/source/reference/pointcloud_segmentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,24 @@ Here's the full example:
:language: python
:lines: 14-



.. image:: https://raw.githubusercontent.com/intel-isl/Open3D-ML/master/docs/images/getting_started_ml_visualizer.gif
:width: 100%

------

**********
Flash Zero
**********

The point cloud segmentation task can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash pointcloud-segmentation
To view configuration options and options for running the point cloud segmentation task with your own data, use:

.. code-block:: bash
flash pointcloud-segmentation --help
21 changes: 21 additions & 0 deletions docs/source/reference/semantic_segmentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ Here's the full example:
:language: python
:lines: 14-


------

**********
Flash Zero
**********

The semantic segmentation task can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash semantic-segmentation
To view configuration options and options for running the semantic segmentation task with your own data, use:

.. code-block:: bash
flash semantic-segmentation --help
------

*******
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/speech_recognition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ Here's the full example:

------

**********
Flash Zero
**********

The speech recognition task can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash speech-recognition
To view configuration options and options for running the speech recognition task with your own data, use:

.. code-block:: bash
flash speech-recognition --help
------

*******
Serving
*******
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/style_transfer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,22 @@ Here's the full example:
.. literalinclude:: ../../../flash_examples/style_transfer.py
:language: python
:lines: 14-

------

**********
Flash Zero
**********

The style transfer task can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash style-transfer
To view configuration options and options for running the style transfer task with your own data, use:

.. code-block:: bash
flash style-transfer --help
19 changes: 19 additions & 0 deletions docs/source/reference/summarization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ Here's the full example:

------

**********
Flash Zero
**********

The summarization task can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash summarization
To view configuration options and options for running the summarization task with your own data, use:

.. code-block:: bash
flash summarization --help
------

*******
Serving
*******
Expand Down
19 changes: 19 additions & 0 deletions docs/source/reference/tabular_classification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ Here's the full example:

------

**********
Flash Zero
**********

The tabular classifier can be used directly from the command line with zero code using :ref:`flash_zero`.
You can run the above example with:

.. code-block:: bash
flash tabular-classifier
To view configuration options and options for running the tabular classifier with your own data, use:

.. code-block:: bash
flash tabular-classifier --help
------

*******
Serving
*******
Expand Down
Loading

0 comments on commit 8e42d39

Please sign in to comment.