class_docstr: The ``TextClassificationData`` class is a :class:`~flash.core.data.data_module.DataModule` with a set of
  classmethods for loading data for text classification.
class_docstr_tok: ["The","``","TextClassificationData","``","class","is","a",":","class",":","`","~flash.core.data.data_module.DataModule","`","with","a","set","of","classmethods","for","loading","data","for","text","classification","."]
docstr: Load the :class:`~flash.text.classification.data.TextClassificationData` from lists of text snippets and
  corresponding lists of targets.
  
  The targets can be in any of our
  :ref:`supported classification target formats <formatting_classification_targets>`.
  To learn how to customize the transforms applied for each stage, read our
  :ref:`customizing transforms guide <customizing_transforms>`.
  
  Args:
      train_data: The list of text snippets to use when training.
      train_targets: The list of targets to use when training.
      val_data: The list of text snippets to use when validating.
      val_targets: The list of targets to use when validating.
      test_data: The list of text snippets to use when testing.
      test_targets: The list of targets to use when testing.
      predict_data: The list of text snippets to use when predicting.
      target_formatter: Optionally provide a :class:`~flash.core.data.utilities.classification.TargetFormatter` to
          control how targets are handled. See :ref:`formatting_classification_targets` for more details.
      input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
      transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
      transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
      data_module_kwargs: Additional keyword arguments to provide to the
          :class:`~flash.core.data.data_module.DataModule` constructor.
  
  Returns:
      The constructed :class:`~flash.text.classification.data.TextClassificationData`.
  
  Examples
  ________
  
  .. doctest::
  
      >>> from flash import Trainer
      >>> from flash.text import TextClassifier, TextClassificationData
      >>> datamodule = TextClassificationData.from_lists(
      ...     train_data=["Best movie ever!", "Not good", "Fine I guess"],
      ...     train_targets=["positive", "negative", "neutral"],
      ...     predict_data=["Worst movie ever!", "I didn't enjoy it", "It was ok"],
      ...     batch_size=2,
      ... )
      >>> datamodule.num_classes
      3
      >>> datamodule.labels
      ['negative', 'neutral', 'positive']
      >>> model = TextClassifier(num_classes=datamodule.num_classes, backbone="prajjwal1/bert-tiny")
      >>> trainer = Trainer(fast_dev_run=True)
      >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Training...
      >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Predicting...
docstr_tok: ["Load","the",":","class",":","`","~flash.text.classification.data.TextClassificationData","`","from","lists","of","text","snippets","and","corresponding","lists","of","targets",".","The","targets","can","be","in","any","of","our",":","ref",":","`","supported","classification","target","formats","<","formatting_classification_targets",">","`",".","To","learn","how","to","customize","the","transforms","applied","for","each","stage",",","read","our",":","ref",":","`","customizing","transforms","guide","<","customizing_transforms",">","`",".","Args",":","train_data",":","The","list","of","text","snippets","to","use","when","training",".","train_targets",":","The","list","of","targets","to","use","when","training",".","val_data",":","The","list","of","text","snippets","to","use","when","validating",".","val_targets",":","The","list","of","targets","to","use","when","validating",".","test_data",":","The","list","of","text","snippets","to","use","when","testing",".","test_targets",":","The","list","of","targets","to","use","when","testing",".","predict_data",":","The","list","of","text","snippets","to","use","when","predicting",".","target_formatter",":","Optionally","provide","a",":","class",":","`","~flash.core.data.utilities.classification.TargetFormatter","`","to","control","how","targets","are","handled",".","See",":","ref",":","`","formatting_classification_targets","`","for","more","details",".","input_cls",":","The",":","class",":","`","~flash.core.data.io.input.Input","`","type","to","use","for","loading","the","data",".","transform",":","The",":","class",":","`","~flash.core.data.io.input_transform.InputTransform","`","type","to","use",".","transform_kwargs",":","Dict","of","keyword","arguments","to","be","provided","when","instantiating","the","transforms",".","data_module_kwargs",":","Additional","keyword","arguments","to","provide","to","the",":","class",":","`","~flash.core.data.data_module.DataModule","`","constructor",".","Returns",":","The","constructed",":","class",":","`","~flash.text.classification.data.TextClassificationData","`",".","Examples","________","..","doctest",":",":",">",">",">","from","flash","import","Trainer",">",">",">","from","flash.text","import","TextClassifier",",","TextClassificationData",">",">",">","datamodule","=","TextClassificationData.from_lists","(","...","train_data=","[","``","Best","movie","ever","!","``",",","``","Not","good","''",",","``","Fine","I","guess","''","]",",","...","train_targets=","[","``","positive","''",",","``","negative","''",",","``","neutral","''","]",",","...","predict_data=","[","``","Worst","movie","ever","!","``",",","``","I","did","n't","enjoy","it","''",",","``","It","was","ok","''","]",",","...","batch_size=2",",","...",")",">",">",">","datamodule.num_classes","3",">",">",">","datamodule.labels","[","'negative","'",",","'neutral","'",",","'positive","'","]",">",">",">","model","=","TextClassifier","(","num_classes=datamodule.num_classes",",","backbone=","''","prajjwal1\/bert-tiny","''",")",">",">",">","trainer","=","Trainer","(","fast_dev_run=True",")",">",">",">","trainer.fit","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Training","...",">",">",">","trainer.predict","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Predicting","..."]
code: def from_lists(
      cls,
      train_data: Optional[List[str]] = None,
      train_targets: Optional[Union[List[Any], List[List[Any]]]] = None,
      val_data: Optional[List[str]] = None,
      val_targets: Optional[Union[List[Any], List[List[Any]]]] = None,
      test_data: Optional[List[str]] = None,
      test_targets: Optional[Union[List[Any], List[List[Any]]]] = None,
      predict_data: Optional[List[str]] = None,
      target_formatter: Optional[TargetFormatter] = None,
      input_cls: Type[Input] = TextClassificationListInput,
      transform: Optional[Dict[str, Callable]] = InputTransform,
      transform_kwargs: Optional[Dict] = None,
      **data_module_kwargs: Any,
  ) -> "TextClassificationData":
      """Load the :class:`~flash.text.classification.data.TextClassificationData` from lists of text snippets and
      corresponding lists of targets.
  
      The targets can be in any of our
      :ref:`supported classification target formats <formatting_classification_targets>`.
      To learn how to customize the transforms applied for each stage, read our
      :ref:`customizing transforms guide <customizing_transforms>`.
  
      Args:
          train_data: The list of text snippets to use when training.
          train_targets: The list of targets to use when training.
          val_data: The list of text snippets to use when validating.
          val_targets: The list of targets to use when validating.
          test_data: The list of text snippets to use when testing.
          test_targets: The list of targets to use when testing.
          predict_data: The list of text snippets to use when predicting.
          target_formatter: Optionally provide a :class:`~flash.core.data.utilities.classification.TargetFormatter` to
              control how targets are handled. See :ref:`formatting_classification_targets` for more details.
          input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
          transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
          transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
          data_module_kwargs: Additional keyword arguments to provide to the
              :class:`~flash.core.data.data_module.DataModule` constructor.
  
      Returns:
          The constructed :class:`~flash.text.classification.data.TextClassificationData`.
  
      Examples
      ________
  
      .. doctest::
  
          >>> from flash import Trainer
          >>> from flash.text import TextClassifier, TextClassificationData
          >>> datamodule = TextClassificationData.from_lists(
          ...     train_data=["Best movie ever!", "Not good", "Fine I guess"],
          ...     train_targets=["positive", "negative", "neutral"],
          ...     predict_data=["Worst movie ever!", "I didn't enjoy it", "It was ok"],
          ...     batch_size=2,
          ... )
          >>> datamodule.num_classes
          3
          >>> datamodule.labels
          ['negative', 'neutral', 'positive']
          >>> model = TextClassifier(num_classes=datamodule.num_classes, backbone="prajjwal1/bert-tiny")
          >>> trainer = Trainer(fast_dev_run=True)
          >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Training...
          >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Predicting...
  
      """
      ds_kw = {
          "target_formatter": target_formatter,
      }
  
      train_input = input_cls(
          RunningStage.TRAINING, train_data, train_targets, **ds_kw
      )
      ds_kw["target_formatter"] = getattr(
          train_input, "target_formatter", None
      )
  
      return cls(
          train_input,
          input_cls(
              RunningStage.VALIDATING, val_data, val_targets, **ds_kw
          ),
          input_cls(
              RunningStage.TESTING, test_data, test_targets, **ds_kw
          ),
          input_cls(RunningStage.PREDICTING, predict_data, **ds_kw),
          transform=transform,
          transform_kwargs=transform_kwargs,
          **data_module_kwargs,
      )
  
file_path: lightning-flash/src/flash/text/classification/data.py
imports: from typing import Any, Callable, Dict, List, Optional, Sequence, Type, Union
  from pandas.core.frame import DataFrame
  from flash.core.data.data_module import DataModule
  from flash.core.data.io.input import Input
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.data.utilities.classification import TargetFormatter
  from flash.core.data.utilities.paths import PATH_TYPE
  from flash.core.integrations.labelstudio.input import LabelStudioTextClassificationInput, _parse_labelstudio_arguments
  from flash.core.utilities.imports import _TOPIC_TEXT_AVAILABLE
  from flash.core.utilities.stages import RunningStage
  from flash.text.classification.input import TextClassificationCSVInput, TextClassificationDataFrameInput, TextClassificationInput, TextClassificationJSONInput, TextClassificationListInput, TextClassificationParquetInput
label_desc: Use image node_id 6 for calling the TextClassificationData obj's underlying member method code with example usage: obj.from_lists(cls, train_data, train_targets, val_data, val_targets, test_data, test_targets, predict_data, target_formatter, input_cls, transform, transform_kwargs) and returns: cls