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

Rename DataSource to Input #929

Merged
merged 30 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
54414ad
rename
ananyahjha93 Nov 4, 2021
d8cbb64
pre-commit
ananyahjha93 Nov 4, 2021
bd9d886
data_source
ananyahjha93 Nov 9, 2021
12c4f0f
precommit
ananyahjha93 Nov 9, 2021
0675813
docs
ananyahjha93 Nov 9, 2021
82dd857
docs
ananyahjha93 Nov 9, 2021
0b4462f
Merge branch 'master' into refactor/data_source
ananyahjha93 Nov 9, 2021
7dd0697
Merge branch 'refactor/data_source' of https://github.com/PyTorchLigh…
ananyahjha93 Nov 9, 2021
89272ee
.
ananyahjha93 Nov 9, 2021
e49c343
Revert batch
ethanwharris Nov 9, 2021
43c3702
.
ananyahjha93 Nov 9, 2021
d1f9561
Merge branch 'refactor/data_source' of https://github.com/PyTorchLigh…
ananyahjha93 Nov 9, 2021
f29ad0e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2021
e02ca54
.
ananyahjha93 Nov 9, 2021
6af04da
Merge branch 'refactor/data_source' of https://github.com/PyTorchLigh…
ananyahjha93 Nov 9, 2021
c435cec
.
ananyahjha93 Nov 9, 2021
c0b6f4c
.
ananyahjha93 Nov 9, 2021
e4d93b7
.
ananyahjha93 Nov 9, 2021
91fa707
.
ananyahjha93 Nov 9, 2021
a6fec41
Docs
ethanwharris Nov 10, 2021
2e88b26
Docs
ethanwharris Nov 10, 2021
cb68936
Deprecate predict data_source argument
ethanwharris Nov 10, 2021
0d3afd0
Argument order
ethanwharris Nov 10, 2021
a9f3bb2
Move tests
ethanwharris Nov 10, 2021
e70cebb
Sort
ethanwharris Nov 10, 2021
d6f47f8
InputDataKeys -> DataKeys and deprecate
ethanwharris Nov 10, 2021
dd0c29b
Fixes
ethanwharris Nov 10, 2021
210f3e4
Add test
ethanwharris Nov 10, 2021
3a964a1
Update CHANGELOG.md
ethanwharris Nov 10, 2021
9c8b70f
Revert debug
ethanwharris Nov 10, 2021
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Changed

- Changed `DataSource` to `Input` ([#929](https://github.com/PyTorchLightning/lightning-flash/pull/929))

- Changed `Preprocess` to `InputTransform` ([#951](https://github.com/PyTorchLightning/lightning-flash/pull/951))

- Changed classes named `*Serializer` and properties / variables named `serializer` to be `*Output` and `output` respectively ([#927](https://github.com/PyTorchLightning/lightning-flash/pull/927))
Expand All @@ -30,6 +32,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Deprecated `flash.text.seq2seq.core.metrics` in favour of `torchmetrics[text]` ([#648](https://github.com/PyTorchLightning/lightning-flash/pull/648))

- Deprecated `flash.core.data.data_source.DefaultDataKeys` in favour of `flash.DataKeys` ([#929](https://github.com/PyTorchLightning/lightning-flash/pull/929))

- Deprecated `data_source` argument to `flash.Task.predict` in favour of `input` ([#929](https://github.com/PyTorchLightning/lightning-flash/pull/929))

### Fixed

### Removed
Expand Down
7 changes: 2 additions & 5 deletions docs/extensions/autodatasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,14 @@ def _resolve_transforms(_):
return None

input_transform = PatchedInputTransform()
data_sources = {
data_source: input_transform.data_source_of_name(data_source)
for data_source in input_transform.available_data_sources()
}
inputs = {input: input_transform.input_of_name(input) for input in input_transform.available_inputs()}

ENVIRONMENT.get_template("base.rst")

rendered_content = ENVIRONMENT.get_template(data_module_name).render(
data_module=f":class:`~{data_module_path}.{data_module_name}`",
data_module_raw=data_module_name,
data_sources=data_sources,
inputs=inputs,
)

node = nodes.section()
Expand Down
18 changes: 9 additions & 9 deletions docs/extensions/templates/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

This section details the available ways to load your own data into the {{ data_module }}.

{% if 'folders' in data_sources %}
{% if 'folders' in inputs %}
{% call render_subsection('from_folders') %}

{% block from_folders %}
Construct the {{ data_module }} from folders.

{% if data_sources['folders'].extensions is defined %}
The supported file extensions are: {{ data_sources['folders'].extensions|join(', ') }}.
{% set extension = data_sources['folders'].extensions[0] %}
{% if inputs['folders'].extensions is defined %}
The supported file extensions are: {{ inputs['folders'].extensions|join(', ') }}.
{% set extension = inputs['folders'].extensions[0] %}
{% else %}
{% set extension = '' %}
{% endif %}
Expand Down Expand Up @@ -54,15 +54,15 @@ Example::
{% endblock %}
{% endcall %}
{% endif %}
{% if 'files' in data_sources %}
{% if 'files' in inputs %}
{% call render_subsection('from_files') %}

{% block from_files %}
Construct the {{ data_module }} from lists of files and corresponding lists of targets.

{% if data_sources['files'].extensions is defined %}
The supported file extensions are: {{ data_sources['files'].extensions|join(', ') }}.
{% set extension = data_sources['files'].extensions[0] %}
{% if inputs['files'].extensions is defined %}
The supported file extensions are: {{ inputs['files'].extensions|join(', ') }}.
{% set extension = inputs['files'].extensions[0] %}
{% else %}
{% set extension = '' %}
{% endif %}
Expand All @@ -80,7 +80,7 @@ Example::
{% endblock %}
{% endcall %}
{% endif %}
{% if 'datasets' in data_sources %}
{% if 'datasets' in inputs %}
{% call render_subsection('from_datasets') %}

{% block from_datasets %}
Expand Down
10 changes: 5 additions & 5 deletions docs/source/api/audio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ __________________
speech_recognition.data.SpeechRecognitionInputTransform
speech_recognition.data.SpeechRecognitionBackboneState
speech_recognition.data.SpeechRecognitionOutputTransform
speech_recognition.data.SpeechRecognitionCSVDataSource
speech_recognition.data.SpeechRecognitionJSONDataSource
speech_recognition.data.SpeechRecognitionCSVInput
speech_recognition.data.SpeechRecognitionJSONInput
speech_recognition.data.BaseSpeechRecognition
speech_recognition.data.SpeechRecognitionFileDataSource
speech_recognition.data.SpeechRecognitionPathsDataSource
speech_recognition.data.SpeechRecognitionDatasetDataSource
speech_recognition.data.SpeechRecognitionFileInput
speech_recognition.data.SpeechRecognitionPathsInput
speech_recognition.data.SpeechRecognitionDatasetInput
speech_recognition.data.SpeechRecognitionDeserializer
32 changes: 16 additions & 16 deletions docs/source/api/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,34 @@ _____________________________
~flash.core.data.data_pipeline.DataPipeline
~flash.core.data.data_pipeline.DataPipelineState

flash.core.data.data_source
flash.core.data.io.input
___________________________

.. autosummary::
:toctree: generated/
:nosignatures:
:template: classtemplate.rst

~flash.core.data.data_source.DatasetDataSource
~flash.core.data.data_source.DataSource
~flash.core.data.data_source.DefaultDataKeys
~flash.core.data.data_source.DefaultDataSources
~flash.core.data.data_source.FiftyOneDataSource
~flash.core.data.data_source.ImageLabelsMap
~flash.core.data.data_source.LabelsState
~flash.core.data.data_source.MockDataset
~flash.core.data.data_source.NumpyDataSource
~flash.core.data.data_source.PathsDataSource
~flash.core.data.data_source.SequenceDataSource
~flash.core.data.data_source.TensorDataSource
~flash.core.data.io.input.DatasetInput
~flash.core.data.io.input.Input
~flash.core.data.io.input.DataKeys
~flash.core.data.io.input.InputFormat
~flash.core.data.io.input.FiftyOneInput
~flash.core.data.io.input.ImageLabelsMap
~flash.core.data.io.input.LabelsState
~flash.core.data.io.input.MockDataset
~flash.core.data.io.input.NumpyInput
~flash.core.data.io.input.PathsInput
~flash.core.data.io.input.SequenceInput
~flash.core.data.io.input.TensorInput

.. autosummary::
:toctree: generated/
:nosignatures:

~flash.core.data.data_source.has_file_allowed_extension
~flash.core.data.data_source.has_len
~flash.core.data.data_source.make_dataset
~flash.core.data.io.input.has_file_allowed_extension
~flash.core.data.io.input.has_len
~flash.core.data.io.input.make_dataset

flash.core.data.process
_______________________
Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/flash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ flash
:nosignatures:
:template: classtemplate.rst

~flash.core.data.data_source.DataSource
~flash.core.data.io.input.Input
~flash.core.data.data_module.DataModule
~flash.core.data.callback.FlashCallback
~flash.core.data.io.output_transform.OutputTransform
Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/graph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ ________________
:nosignatures:
:template: classtemplate.rst

~data.GraphDatasetDataSource
~data.GraphDatasetInput
18 changes: 9 additions & 9 deletions docs/source/api/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ________________
~detection.data.ObjectDetectionData

detection.data.FiftyOneParser
detection.data.ObjectDetectionFiftyOneDataSource
detection.data.ObjectDetectionFiftyOneInput
detection.output.FiftyOneDetectionLabels
detection.data.ObjectDetectionInputTransform

Expand Down Expand Up @@ -96,10 +96,10 @@ ____________
~segmentation.data.SemanticSegmentationInputTransform

segmentation.data.SegmentationMatplotlibVisualization
segmentation.data.SemanticSegmentationNumpyDataSource
segmentation.data.SemanticSegmentationTensorDataSource
segmentation.data.SemanticSegmentationPathsDataSource
segmentation.data.SemanticSegmentationFiftyOneDataSource
segmentation.data.SemanticSegmentationNumpyInput
segmentation.data.SemanticSegmentationTensorInput
segmentation.data.SemanticSegmentationPathsInput
segmentation.data.SemanticSegmentationFiftyOneInput
segmentation.data.SemanticSegmentationDeserializer
segmentation.model.SemanticSegmentationOutputTransform
segmentation.output.FiftyOneSegmentationLabels
Expand Down Expand Up @@ -140,7 +140,7 @@ ________________
:template: classtemplate.rst

~data.ImageDeserializer
~data.ImageFiftyOneDataSource
~data.ImageNumpyDataSource
~data.ImagePathsDataSource
~data.ImageTensorDataSource
~data.ImageFiftyOneInput
~data.ImageNumpyInput
~data.ImagePathsInput
~data.ImageTensorInput
8 changes: 4 additions & 4 deletions docs/source/api/pointcloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ____________
~segmentation.data.PointCloudSegmentationData

segmentation.data.PointCloudSegmentationInputTransform
segmentation.data.PointCloudSegmentationFoldersDataSource
segmentation.data.PointCloudSegmentationDatasetDataSource
segmentation.data.PointCloudSegmentationFoldersInput
segmentation.data.PointCloudSegmentationDatasetInput

Object Detection
________________
Expand All @@ -36,5 +36,5 @@ ________________
~detection.data.PointCloudObjectDetectorData

detection.data.PointCloudObjectDetectorInputTransform
detection.data.PointCloudObjectDetectorFoldersDataSource
detection.data.PointCloudObjectDetectorDatasetDataSource
detection.data.PointCloudObjectDetectorFoldersInput
detection.data.PointCloudObjectDetectorDatasetInput
6 changes: 3 additions & 3 deletions docs/source/api/tabular.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ___________
~forecasting.data.TabularForecastingData

forecasting.data.TabularForecastingInputTransform
forecasting.data.TabularForecastingDataFrameDataSource
forecasting.data.TabularForecastingDataFrameInput
forecasting.data.TimeSeriesDataSetParametersState

flash.tabular.data
Expand All @@ -55,8 +55,8 @@ __________________
:template: classtemplate.rst

~data.TabularData
~data.TabularDataFrameDataSource
~data.TabularCSVDataSource
~data.TabularDataFrameInput
~data.TabularCSVInput
~data.TabularDeserializer
~data.TabularOutputTransform
~data.TabularInputTransform
38 changes: 19 additions & 19 deletions docs/source/api/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ ______________
classification.data.TextClassificationOutputTransform
classification.data.TextClassificationInputTransform
classification.data.TextDeserializer
classification.data.TextDataSource
classification.data.TextCSVDataSource
classification.data.TextJSONDataSource
classification.data.TextDataFrameDataSource
classification.data.TextParquetDataSource
classification.data.TextHuggingFaceDatasetDataSource
classification.data.TextListDataSource
classification.data.TextInput
classification.data.TextCSVInput
classification.data.TextJSONInput
classification.data.TextDataFrameInput
classification.data.TextParquetInput
classification.data.TextHuggingFaceDatasetInput
classification.data.TextListInput

Question Answering
__________________
Expand All @@ -43,15 +43,14 @@ __________________
~question_answering.data.QuestionAnsweringData

question_answering.data.QuestionAnsweringBackboneState
question_answering.data.QuestionAnsweringCSVDataSource
question_answering.data.QuestionAnsweringDataSource
question_answering.data.QuestionAnsweringDictionaryDataSource
question_answering.data.QuestionAnsweringFileDataSource
question_answering.data.QuestionAnsweringJSONDataSource
question_answering.data.QuestionAnsweringCSVInput
question_answering.data.QuestionAnsweringInput
question_answering.data.QuestionAnsweringDictionaryInput
question_answering.data.QuestionAnsweringFileInput
question_answering.data.QuestionAnsweringJSONInput
question_answering.data.QuestionAnsweringOutputTransform
question_answering.data.QuestionAnsweringInputTransform
question_answering.data.SQuADDataSource

question_answering.data.SQuADInput

Summarization
_____________
Expand Down Expand Up @@ -92,10 +91,11 @@ _______________
~seq2seq.core.finetuning.Seq2SeqFreezeEmbeddings

seq2seq.core.data.Seq2SeqBackboneState
seq2seq.core.data.Seq2SeqCSVDataSource
seq2seq.core.data.Seq2SeqDataSource
seq2seq.core.data.Seq2SeqFileDataSource
seq2seq.core.data.Seq2SeqJSONDataSource
seq2seq.core.data.Seq2SeqCSVInput
seq2seq.core.data.Seq2SeqInput
seq2seq.core.data.Seq2SeqFileInput
seq2seq.core.data.Seq2SeqJSONInput
seq2seq.core.data.Seq2SeqOutputTransform
seq2seq.core.data.Seq2SeqInputTransform
seq2seq.core.data.Seq2SeqSentencesDataSource
seq2seq.core.data.Seq2SeqSentencesInput
seq2seq.core.metrics.BLEUScore
4 changes: 2 additions & 2 deletions docs/source/api/video.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ______________
~classification.data.VideoClassificationData

classification.data.BaseVideoClassification
classification.data.VideoClassificationFiftyOneDataSource
classification.data.VideoClassificationPathsDataSource
classification.data.VideoClassificationFiftyOneInput
classification.data.VideoClassificationPathsInput
classification.data.VideoClassificationInputTransform
classification.model.VideoClassifierFinetuning
Loading