def from_csv(
        cls,
        categorical_fields: Optional[Union[str, List[str]]] = None,
        numerical_fields: Optional[Union[str, List[str]]] = None,
        target_field: Optional[str] = None,
        parameters: Optional[Dict[str, Any]] = None,
        train_file: Optional[str] = None,
        val_file: Optional[str] = None,
        test_file: Optional[str] = None,
        predict_file: Optional[str] = None,
        input_cls: Type[Input] = TabularRegressionCSVInput,
        transform: INPUT_TRANSFORM_TYPE = InputTransform,
        transform_kwargs: Optional[Dict] = None,
        **data_module_kwargs: Any,
    ) -> "TabularRegressionData":
        """Creates a :class:`~flash.tabular.regression.data.TabularRegressionData` object from the given CSV files.

        .. note::

            The ``categorical_fields``, ``numerical_fields``, and ``target_field`` do not need to be provided if
            ``parameters`` are passed instead. These can be obtained from the
            :attr:`~flash.tabular.data.TabularData.parameters` attribute of the
            :class:`~flash.tabular.data.TabularData` object that contains your training data.

        The targets will be extracted from the ``target_field`` in the CSV files.
        To learn how to customize the transforms applied for each stage, read our
        :ref:`customizing transforms guide <customizing_transforms>`.

        Args:
            categorical_fields: The fields (column names) in the CSV files containing categorical data.
            numerical_fields: The fields (column names) in the CSV files containing numerical data.
            target_field: The field (column name) in the CSV files containing the targets.
            parameters: Parameters to use if ``categorical_fields``, ``numerical_fields``, and ``target_field`` are not
                provided (e.g. when loading data for inference or validation).
            train_file: The path to the CSV file to use when training.
            val_file: The path to the CSV file to use when validating.
            test_file: The path to the CSV file to use when testing.
            predict_file: The path to the CSV file to use when predicting.
            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.tabular.regression.data.TabularRegressionData`.

        Examples
        ________

        The files can be in Comma Separated Values (CSV) format with either a ``.csv`` or ``.txt`` extension.

        .. testsetup::

            >>> from pandas import DataFrame
            >>> DataFrame.from_dict({
            ...     "age": [2, 4, 1],
            ...     "animal": ["cat", "dog", "cat"],
            ...     "weight": [6, 10, 5],
            ... }).to_csv("train_data.csv")
            >>> DataFrame.from_dict({
            ...     "animal": ["dog", "dog", "cat"],
            ...     "weight": [7, 12, 5],
            ... }).to_csv("predict_data.csv")

        We have a ``train_data.csv`` with the following contents:

        .. code-block::

            age,animal,weight
            2,cat,6
            4,dog,10
            1,cat,5

        and a ``predict_data.csv`` with the following contents:

        .. code-block::

            animal,weight
            dog,7
            dog,12
            cat,5

        .. doctest::

            >>> from flash import Trainer
            >>> from flash.tabular import TabularRegressor, TabularRegressionData
            >>> datamodule = TabularRegressionData.from_csv(
            ...     "animal",
            ...     "weight",
            ...     "age",
            ...     train_file="train_data.csv",
            ...     predict_file="predict_data.csv",
            ...     batch_size=4,
            ... )
            >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
            >>> 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...

        .. testcleanup::

            >>> import os
            >>> os.remove("train_data.csv")
            >>> os.remove("predict_data.csv")

        Alternatively, the files can be in Tab Separated Values (TSV) format with a ``.tsv`` extension.

        .. testsetup::

            >>> from pandas import DataFrame
            >>> DataFrame.from_dict({
            ...     "age": [2, 4, 1],
            ...     "animal": ["cat", "dog", "cat"],
            ...     "weight": [6, 10, 5],
            ... }).to_csv("train_data.tsv", sep="\\t")
            >>> DataFrame.from_dict({
            ...     "animal": ["dog", "dog", "cat"],
            ...     "weight": [7, 12, 5],
            ... }).to_csv("predict_data.tsv", sep="\\t")

        We have a ``train_data.tsv`` with the following contents:

        .. code-block::

            age animal  weight
            2   cat     6
            4   dog     10
            1   cat     5

        and a ``predict_data.tsv`` with the following contents:

        .. code-block::

            animal  weight
            dog     7
            dog     12
            cat     5

        .. doctest::

            >>> from flash import Trainer
            >>> from flash.tabular import TabularRegressor, TabularRegressionData
            >>> datamodule = TabularRegressionData.from_csv(
            ...     "animal",
            ...     "weight",
            ...     "age",
            ...     train_file="train_data.tsv",
            ...     predict_file="predict_data.tsv",
            ...     batch_size=4,
            ... )
            >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
            >>> 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...

        .. testcleanup::

            >>> import os
            >>> os.remove("train_data.tsv")
            >>> os.remove("predict_data.tsv")

        """
        ds_kw = {
            "categorical_fields": categorical_fields,
            "numerical_fields": numerical_fields,
            "target_field": target_field,
            "parameters": parameters,
        }

        train_input = input_cls(RunningStage.TRAINING, train_file, **ds_kw)
        ds_kw["parameters"] = train_input.parameters if train_input else parameters

        return cls(
            train_input,
            input_cls(RunningStage.VALIDATING, val_file, **ds_kw),
            input_cls(RunningStage.TESTING, test_file, **ds_kw),
            input_cls(RunningStage.PREDICTING, predict_file, **ds_kw),
            transform=transform,
            transform_kwargs=transform_kwargs,
            **data_module_kwargs,
        )
Creates a :class:`~flash.tabular.regression.data.TabularRegressionData` object from the given CSV files.

        .. note::

            The ``categorical_fields``, ``numerical_fields``, and ``target_field`` do not need to be provided if
            ``parameters`` are passed instead. These can be obtained from the
            :attr:`~flash.tabular.data.TabularData.parameters` attribute of the
            :class:`~flash.tabular.data.TabularData` object that contains your training data.

        The targets will be extracted from the ``target_field`` in the CSV files.
        To learn how to customize the transforms applied for each stage, read our
        :ref:`customizing transforms guide <customizing_transforms>`.

        Args:
            categorical_fields: The fields (column names) in the CSV files containing categorical data.
            numerical_fields: The fields (column names) in the CSV files containing numerical data.
            target_field: The field (column name) in the CSV files containing the targets.
            parameters: Parameters to use if ``categorical_fields``, ``numerical_fields``, and ``target_field`` are not
                provided (e.g. when loading data for inference or validation).
            train_file: The path to the CSV file to use when training.
            val_file: The path to the CSV file to use when validating.
            test_file: The path to the CSV file to use when testing.
            predict_file: The path to the CSV file to use when predicting.
            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.tabular.regression.data.TabularRegressionData`.

        Examples
        ________

        The files can be in Comma Separated Values (CSV) format with either a ``.csv`` or ``.txt`` extension.

        .. testsetup::

            >>> from pandas import DataFrame
            >>> DataFrame.from_dict({
            ...     "age": [2, 4, 1],
            ...     "animal": ["cat", "dog", "cat"],
            ...     "weight": [6, 10, 5],
            ... }).to_csv("train_data.csv")
            >>> DataFrame.from_dict({
            ...     "animal": ["dog", "dog", "cat"],
            ...     "weight": [7, 12, 5],
            ... }).to_csv("predict_data.csv")

        We have a ``train_data.csv`` with the following contents:

        .. code-block::

            age,animal,weight
            2,cat,6
            4,dog,10
            1,cat,5

        and a ``predict_data.csv`` with the following contents:

        .. code-block::

            animal,weight
            dog,7
            dog,12
            cat,5

        .. doctest::

            >>> from flash import Trainer
            >>> from flash.tabular import TabularRegressor, TabularRegressionData
            >>> datamodule = TabularRegressionData.from_csv(
            ...     "animal",
            ...     "weight",
            ...     "age",
            ...     train_file="train_data.csv",
            ...     predict_file="predict_data.csv",
            ...     batch_size=4,
            ... )
            >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
            >>> 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...

        .. testcleanup::

            >>> import os
            >>> os.remove("train_data.csv")
            >>> os.remove("predict_data.csv")

        Alternatively, the files can be in Tab Separated Values (TSV) format with a ``.tsv`` extension.

        .. testsetup::

            >>> from pandas import DataFrame
            >>> DataFrame.from_dict({
            ...     "age": [2, 4, 1],
            ...     "animal": ["cat", "dog", "cat"],
            ...     "weight": [6, 10, 5],
            ... }).to_csv("train_data.tsv", sep="\t")
            >>> DataFrame.from_dict({
            ...     "animal": ["dog", "dog", "cat"],
            ...     "weight": [7, 12, 5],
            ... }).to_csv("predict_data.tsv", sep="\t")

        We have a ``train_data.tsv`` with the following contents:

        .. code-block::

            age animal  weight
            2   cat     6
            4   dog     10
            1   cat     5

        and a ``predict_data.tsv`` with the following contents:

        .. code-block::

            animal  weight
            dog     7
            dog     12
            cat     5

        .. doctest::

            >>> from flash import Trainer
            >>> from flash.tabular import TabularRegressor, TabularRegressionData
            >>> datamodule = TabularRegressionData.from_csv(
            ...     "animal",
            ...     "weight",
            ...     "age",
            ...     train_file="train_data.tsv",
            ...     predict_file="predict_data.tsv",
            ...     batch_size=4,
            ... )
            >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
            >>> 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...

        .. testcleanup::

            >>> import os
            >>> os.remove("train_data.tsv")
            >>> os.remove("predict_data.tsv")

        
src/flash/tabular/regression/data.py