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

Commit

Permalink
Rename DataSource to Input (#929)
Browse files Browse the repository at this point in the history
Co-authored-by: Ethan Harris <ethanwharris@gmail.com>
  • Loading branch information
ananyahjha93 and ethanwharris authored Nov 10, 2021
1 parent 00ef240 commit e983c1e
Show file tree
Hide file tree
Showing 129 changed files with 2,046 additions and 1,974 deletions.
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

0 comments on commit e983c1e

Please sign in to comment.