We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cannot run on iris dataset
## 🐛 Bug

Cannot run on iris dataset

### To Reproduce

Run the code sample. CSV file is attached
[iris.csv](https://github.com/PyTorchLightning/lightning-flash/files/7967078/iris.csv)

Error message:
```
Num classes: 3
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
/Users/minh.chau/miniconda3/envs/chem/lib/python3.7/site-packages/pytorch_lightning/trainer/configuration_validator.py:122: UserWarning: You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.
  rank_zero_warn("You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.")

  | Name          | Type       | Params
---------------------------------------------
0 | model         | TabNet     | 5.9 K 
1 | train_metrics | ModuleDict | 0     
2 | val_metrics   | ModuleDict | 0     
3 | test_metrics  | ModuleDict | 0     
---------------------------------------------
5.9 K     Trainable params
0         Non-trainable params
5.9 K     Total params
0.024     Total estimated model params size (MB)
......many lines later.............
    return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
IndexError: Target 3 is out of bounds.
```

#### Code sample
```python
import pandas as pd
t=pd.read_csv("iris.csv")

datamodule = TabularClassificationData.from_csv(
    numerical_fields=["sepal.length","sepal.width","petal.length","petal.width"],
    target_fields="variety",
    train_file="iris.csv",
    val_split=0.3,
    batch_size=4
)
print(f"Num classes: {datamodule.num_classes}")
model = TabularClassifier.from_data(datamodule)
```

### Expected behavior

A model is created as expected

### Environment

 - PyTorch Version (e.g., 1.0): 1.9.0
 - OS (e.g., Linux): MacOS
 - How you installed PyTorch (`conda`, `pip`, source): conda
 - Python version: 3.7
 - CUDA/cuDNN version: No
 - GPU models and configuration: No

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `flash/tabular/input.py`
Content:
```
1 # Copyright The PyTorch Lightning team.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from dataclasses import dataclass
15 from io import StringIO
16 from typing import Any, Dict, List, Optional, Union
17 
18 import numpy as np
19 from pytorch_lightning.utilities.exceptions import MisconfigurationException
20 
21 from flash.core.data.io.input import DataKeys, Input
22 from flash.core.data.process import Deserializer
23 from flash.core.data.properties import ProcessState
24 from flash.core.data.utilities.data_frame import read_csv
25 from flash.core.utilities.imports import _PANDAS_AVAILABLE
26 from flash.tabular.classification.utils import (
27     _compute_normalization,
28     _generate_codes,
29     _pre_transform,
30     _to_cat_vars_numpy,
31     _to_num_vars_numpy,
32 )
33 
34 if _PANDAS_AVAILABLE:
35     from pandas.core.frame import DataFrame
36 else:
37     DataFrame = object
38 
39 
40 @dataclass(unsafe_hash=True, frozen=True)
41 class TabularParametersState(ProcessState):
42     """A :class:`~flash.core.data.properties.ProcessState` containing tabular data ``parameters``."""
43 
44     parameters: Optional[Dict[str, Any]]
45 
46 
47 class TabularDataFrameInput(Input):
48     @staticmethod
49     def _sanetize_fields(
50         categorical_fields: Optional[Union[str, List[str]]], numerical_fields: Optional[Union[str, List[str]]]
51     ):
52         if categorical_fields is None and numerical_fields is None:
53             raise RuntimeError("Both `categorical_fields` and `numerical_fields` are None!")
54 
55         categorical_fields = categorical_fields or []
56         numerical_fields = numerical_fields or []
57 
58         if not isinstance(categorical_fields, list):
59             categorical_fields = [categorical_fields]
60 
61         if not isinstance(numerical_fields, list):
62             numerical_fields = [numerical_fields]
63 
64         return categorical_fields, numerical_fields
65 
66     @staticmethod
67     def compute_parameters(
68         train_data_frame: DataFrame,
69         numerical_fields: List[str],
70         categorical_fields: List[str],
71     ) -> Dict[str, Any]:
72 
73         mean, std = _compute_normalization(train_data_frame, numerical_fields)
74 
75         codes = _generate_codes(train_data_frame, categorical_fields)
76 
77         return dict(
78             mean=mean,
79             std=std,
80             codes=codes,
81             numerical_fields=numerical_fields,
82             categorical_fields=categorical_fields,
83         )
84 
85     def preprocess(
86         self,
87         df: DataFrame,
88         categorical_fields: Optional[List[str]] = None,
89         numerical_fields: Optional[List[str]] = None,
90         parameters: Dict[str, Any] = None,
91     ):
92         if self.training:
93             categorical_fields, numerical_fields = self._sanetize_fields(categorical_fields, numerical_fields)
94             parameters = self.compute_parameters(df, numerical_fields, categorical_fields)
95 
96             self.set_state(TabularParametersState(parameters))
97         else:
98             parameters_state = self.get_state(TabularParametersState)
99             parameters = parameters or (parameters_state.parameters if parameters_state is not None else None)
100             if parameters is None:
101                 raise MisconfigurationException(
102                     "Loading tabular data for evaluation or inference requires parameters from the train data. Either "
103                     "construct the train data at the same time as evaluation and inference or provide the train "
104                     "`datamodule.parameters` in the `parameters` argument."
105                 )
106 
107         self.parameters = parameters
108 
109         # impute and normalize data
110         df = _pre_transform(
111             df,
112             parameters["numerical_fields"],
113             parameters["categorical_fields"],
114             parameters["codes"],
115             parameters["mean"],
116             parameters["std"],
117         )
118 
119         cat_vars = _to_cat_vars_numpy(df, parameters["categorical_fields"])
120         num_vars = _to_num_vars_numpy(df, parameters["numerical_fields"])
121 
122         num_samples = len(df)
123         cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0))
124         num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0))
125 
126         return cat_vars, num_vars
127 
128 
129 class TabularDeserializer(Deserializer):
130     def __init__(self, *args, parameters: Optional[Dict[str, Any]] = None, **kwargs):
131         self._parameters = parameters
132         super().__init__(*args, **kwargs)
133 
134     @property
135     def parameters(self) -> Dict[str, Any]:
136         if self._parameters is not None:
137             return self._parameters
138         parameters_state = self.get_state(TabularParametersState)
139         if parameters_state is not None and parameters_state.parameters is not None:
140             return parameters_state.parameters
141         raise MisconfigurationException(
142             "Tabular tasks must previously have been trained in order to support serving or the `parameters` argument "
143             "must be provided to the `serve` method."
144         )
145 
146     def serve_load_sample(self, data: str) -> Any:
147         parameters = self.parameters
148 
149         df = read_csv(StringIO(data))
150         df = _pre_transform(
151             df,
152             parameters["numerical_fields"],
153             parameters["categorical_fields"],
154             parameters["codes"],
155             parameters["mean"],
156             parameters["std"],
157         )
158 
159         cat_vars = _to_cat_vars_numpy(df, parameters["categorical_fields"])
160         num_vars = _to_num_vars_numpy(df, parameters["numerical_fields"])
161 
162         cat_vars = np.stack(cat_vars, 1)
163         num_vars = np.stack(num_vars, 1)
164 
165         return [{DataKeys.INPUT: [c, n]} for c, n in zip(cat_vars, num_vars)]
166 
167     @property
168     def example_input(self) -> str:
169         parameters = self.parameters
170 
171         row = {}
172         for cat_col in parameters["categorical_fields"]:
173             row[cat_col] = ["test"]
174         for num_col in parameters["numerical_fields"]:
175             row[num_col] = [0]
176         return str(DataFrame.from_dict(row).to_csv())
177
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/flash/tabular/input.py b/flash/tabular/input.py
--- a/flash/tabular/input.py
+++ b/flash/tabular/input.py
@@ -120,8 +120,8 @@
         num_vars = _to_num_vars_numpy(df, parameters["numerical_fields"])
 
         num_samples = len(df)
-        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0))
-        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0))
+        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0), dtype=np.int64)
+        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0), dtype=np.float32)
 
         return cat_vars, num_vars

{"golden_diff": "diff --git a/flash/tabular/input.py b/flash/tabular/input.py\n--- a/flash/tabular/input.py\n+++ b/flash/tabular/input.py\n@@ -120,8 +120,8 @@\n         num_vars = _to_num_vars_numpy(df, parameters[\"numerical_fields\"])\n \n         num_samples = len(df)\n-        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0))\n-        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0))\n+        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0), dtype=np.int64)\n+        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0), dtype=np.float32)\n \n         return cat_vars, num_vars\n", "issue": "Cannot run on iris dataset\n## \ud83d\udc1b Bug\r\n\r\nCannot run on iris dataset\r\n\r\n### To Reproduce\r\n\r\nRun the code sample. CSV file is attached\r\n[iris.csv](https://github.com/PyTorchLightning/lightning-flash/files/7967078/iris.csv)\r\n\r\nError message:\r\n```\r\nNum classes: 3\r\nGPU available: False, used: False\r\nTPU available: False, using: 0 TPU cores\r\nIPU available: False, using: 0 IPUs\r\n/Users/minh.chau/miniconda3/envs/chem/lib/python3.7/site-packages/pytorch_lightning/trainer/configuration_validator.py:122: UserWarning: You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.\r\n  rank_zero_warn(\"You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.\")\r\n\r\n  | Name          | Type       | Params\r\n---------------------------------------------\r\n0 | model         | TabNet     | 5.9 K \r\n1 | train_metrics | ModuleDict | 0     \r\n2 | val_metrics   | ModuleDict | 0     \r\n3 | test_metrics  | ModuleDict | 0     \r\n---------------------------------------------\r\n5.9 K     Trainable params\r\n0         Non-trainable params\r\n5.9 K     Total params\r\n0.024     Total estimated model params size (MB)\r\n......many lines later.............\r\n    return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)\r\nIndexError: Target 3 is out of bounds.\r\n```\r\n\r\n#### Code sample\r\n```python\r\nimport pandas as pd\r\nt=pd.read_csv(\"iris.csv\")\r\n\r\ndatamodule = TabularClassificationData.from_csv(\r\n    numerical_fields=[\"sepal.length\",\"sepal.width\",\"petal.length\",\"petal.width\"],\r\n    target_fields=\"variety\",\r\n    train_file=\"iris.csv\",\r\n    val_split=0.3,\r\n    batch_size=4\r\n)\r\nprint(f\"Num classes: {datamodule.num_classes}\")\r\nmodel = TabularClassifier.from_data(datamodule)\r\n```\r\n\r\n### Expected behavior\r\n\r\nA model is created as expected\r\n\r\n### Environment\r\n\r\n - PyTorch Version (e.g., 1.0): 1.9.0\r\n - OS (e.g., Linux): MacOS\r\n - How you installed PyTorch (`conda`, `pip`, source): conda\r\n - Python version: 3.7\r\n - CUDA/cuDNN version: No\r\n - GPU models and configuration: No\n", "before_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom dataclasses import dataclass\nfrom io import StringIO\nfrom typing import Any, Dict, List, Optional, Union\n\nimport numpy as np\nfrom pytorch_lightning.utilities.exceptions import MisconfigurationException\n\nfrom flash.core.data.io.input import DataKeys, Input\nfrom flash.core.data.process import Deserializer\nfrom flash.core.data.properties import ProcessState\nfrom flash.core.data.utilities.data_frame import read_csv\nfrom flash.core.utilities.imports import _PANDAS_AVAILABLE\nfrom flash.tabular.classification.utils import (\n    _compute_normalization,\n    _generate_codes,\n    _pre_transform,\n    _to_cat_vars_numpy,\n    _to_num_vars_numpy,\n)\n\nif _PANDAS_AVAILABLE:\n    from pandas.core.frame import DataFrame\nelse:\n    DataFrame = object\n\n\n@dataclass(unsafe_hash=True, frozen=True)\nclass TabularParametersState(ProcessState):\n    \"\"\"A :class:`~flash.core.data.properties.ProcessState` containing tabular data ``parameters``.\"\"\"\n\n    parameters: Optional[Dict[str, Any]]\n\n\nclass TabularDataFrameInput(Input):\n    @staticmethod\n    def _sanetize_fields(\n        categorical_fields: Optional[Union[str, List[str]]], numerical_fields: Optional[Union[str, List[str]]]\n    ):\n        if categorical_fields is None and numerical_fields is None:\n            raise RuntimeError(\"Both `categorical_fields` and `numerical_fields` are None!\")\n\n        categorical_fields = categorical_fields or []\n        numerical_fields = numerical_fields or []\n\n        if not isinstance(categorical_fields, list):\n            categorical_fields = [categorical_fields]\n\n        if not isinstance(numerical_fields, list):\n            numerical_fields = [numerical_fields]\n\n        return categorical_fields, numerical_fields\n\n    @staticmethod\n    def compute_parameters(\n        train_data_frame: DataFrame,\n        numerical_fields: List[str],\n        categorical_fields: List[str],\n    ) -> Dict[str, Any]:\n\n        mean, std = _compute_normalization(train_data_frame, numerical_fields)\n\n        codes = _generate_codes(train_data_frame, categorical_fields)\n\n        return dict(\n            mean=mean,\n            std=std,\n            codes=codes,\n            numerical_fields=numerical_fields,\n            categorical_fields=categorical_fields,\n        )\n\n    def preprocess(\n        self,\n        df: DataFrame,\n        categorical_fields: Optional[List[str]] = None,\n        numerical_fields: Optional[List[str]] = None,\n        parameters: Dict[str, Any] = None,\n    ):\n        if self.training:\n            categorical_fields, numerical_fields = self._sanetize_fields(categorical_fields, numerical_fields)\n            parameters = self.compute_parameters(df, numerical_fields, categorical_fields)\n\n            self.set_state(TabularParametersState(parameters))\n        else:\n            parameters_state = self.get_state(TabularParametersState)\n            parameters = parameters or (parameters_state.parameters if parameters_state is not None else None)\n            if parameters is None:\n                raise MisconfigurationException(\n                    \"Loading tabular data for evaluation or inference requires parameters from the train data. Either \"\n                    \"construct the train data at the same time as evaluation and inference or provide the train \"\n                    \"`datamodule.parameters` in the `parameters` argument.\"\n                )\n\n        self.parameters = parameters\n\n        # impute and normalize data\n        df = _pre_transform(\n            df,\n            parameters[\"numerical_fields\"],\n            parameters[\"categorical_fields\"],\n            parameters[\"codes\"],\n            parameters[\"mean\"],\n            parameters[\"std\"],\n        )\n\n        cat_vars = _to_cat_vars_numpy(df, parameters[\"categorical_fields\"])\n        num_vars = _to_num_vars_numpy(df, parameters[\"numerical_fields\"])\n\n        num_samples = len(df)\n        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0))\n        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0))\n\n        return cat_vars, num_vars\n\n\nclass TabularDeserializer(Deserializer):\n    def __init__(self, *args, parameters: Optional[Dict[str, Any]] = None, **kwargs):\n        self._parameters = parameters\n        super().__init__(*args, **kwargs)\n\n    @property\n    def parameters(self) -> Dict[str, Any]:\n        if self._parameters is not None:\n            return self._parameters\n        parameters_state = self.get_state(TabularParametersState)\n        if parameters_state is not None and parameters_state.parameters is not None:\n            return parameters_state.parameters\n        raise MisconfigurationException(\n            \"Tabular tasks must previously have been trained in order to support serving or the `parameters` argument \"\n            \"must be provided to the `serve` method.\"\n        )\n\n    def serve_load_sample(self, data: str) -> Any:\n        parameters = self.parameters\n\n        df = read_csv(StringIO(data))\n        df = _pre_transform(\n            df,\n            parameters[\"numerical_fields\"],\n            parameters[\"categorical_fields\"],\n            parameters[\"codes\"],\n            parameters[\"mean\"],\n            parameters[\"std\"],\n        )\n\n        cat_vars = _to_cat_vars_numpy(df, parameters[\"categorical_fields\"])\n        num_vars = _to_num_vars_numpy(df, parameters[\"numerical_fields\"])\n\n        cat_vars = np.stack(cat_vars, 1)\n        num_vars = np.stack(num_vars, 1)\n\n        return [{DataKeys.INPUT: [c, n]} for c, n in zip(cat_vars, num_vars)]\n\n    @property\n    def example_input(self) -> str:\n        parameters = self.parameters\n\n        row = {}\n        for cat_col in parameters[\"categorical_fields\"]:\n            row[cat_col] = [\"test\"]\n        for num_col in parameters[\"numerical_fields\"]:\n            row[num_col] = [0]\n        return str(DataFrame.from_dict(row).to_csv())\n", "path": "flash/tabular/input.py"}], "after_files": [{"content": "# Copyright The PyTorch Lightning team.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom dataclasses import dataclass\nfrom io import StringIO\nfrom typing import Any, Dict, List, Optional, Union\n\nimport numpy as np\nfrom pytorch_lightning.utilities.exceptions import MisconfigurationException\n\nfrom flash.core.data.io.input import DataKeys, Input\nfrom flash.core.data.process import Deserializer\nfrom flash.core.data.properties import ProcessState\nfrom flash.core.data.utilities.data_frame import read_csv\nfrom flash.core.utilities.imports import _PANDAS_AVAILABLE\nfrom flash.tabular.classification.utils import (\n    _compute_normalization,\n    _generate_codes,\n    _pre_transform,\n    _to_cat_vars_numpy,\n    _to_num_vars_numpy,\n)\n\nif _PANDAS_AVAILABLE:\n    from pandas.core.frame import DataFrame\nelse:\n    DataFrame = object\n\n\n@dataclass(unsafe_hash=True, frozen=True)\nclass TabularParametersState(ProcessState):\n    \"\"\"A :class:`~flash.core.data.properties.ProcessState` containing tabular data ``parameters``.\"\"\"\n\n    parameters: Optional[Dict[str, Any]]\n\n\nclass TabularDataFrameInput(Input):\n    @staticmethod\n    def _sanetize_fields(\n        categorical_fields: Optional[Union[str, List[str]]], numerical_fields: Optional[Union[str, List[str]]]\n    ):\n        if categorical_fields is None and numerical_fields is None:\n            raise RuntimeError(\"Both `categorical_fields` and `numerical_fields` are None!\")\n\n        categorical_fields = categorical_fields or []\n        numerical_fields = numerical_fields or []\n\n        if not isinstance(categorical_fields, list):\n            categorical_fields = [categorical_fields]\n\n        if not isinstance(numerical_fields, list):\n            numerical_fields = [numerical_fields]\n\n        return categorical_fields, numerical_fields\n\n    @staticmethod\n    def compute_parameters(\n        train_data_frame: DataFrame,\n        numerical_fields: List[str],\n        categorical_fields: List[str],\n    ) -> Dict[str, Any]:\n\n        mean, std = _compute_normalization(train_data_frame, numerical_fields)\n\n        codes = _generate_codes(train_data_frame, categorical_fields)\n\n        return dict(\n            mean=mean,\n            std=std,\n            codes=codes,\n            numerical_fields=numerical_fields,\n            categorical_fields=categorical_fields,\n        )\n\n    def preprocess(\n        self,\n        df: DataFrame,\n        categorical_fields: Optional[List[str]] = None,\n        numerical_fields: Optional[List[str]] = None,\n        parameters: Dict[str, Any] = None,\n    ):\n        if self.training:\n            categorical_fields, numerical_fields = self._sanetize_fields(categorical_fields, numerical_fields)\n            parameters = self.compute_parameters(df, numerical_fields, categorical_fields)\n\n            self.set_state(TabularParametersState(parameters))\n        else:\n            parameters_state = self.get_state(TabularParametersState)\n            parameters = parameters or (parameters_state.parameters if parameters_state is not None else None)\n            if parameters is None:\n                raise MisconfigurationException(\n                    \"Loading tabular data for evaluation or inference requires parameters from the train data. Either \"\n                    \"construct the train data at the same time as evaluation and inference or provide the train \"\n                    \"`datamodule.parameters` in the `parameters` argument.\"\n                )\n\n        self.parameters = parameters\n\n        # impute and normalize data\n        df = _pre_transform(\n            df,\n            parameters[\"numerical_fields\"],\n            parameters[\"categorical_fields\"],\n            parameters[\"codes\"],\n            parameters[\"mean\"],\n            parameters[\"std\"],\n        )\n\n        cat_vars = _to_cat_vars_numpy(df, parameters[\"categorical_fields\"])\n        num_vars = _to_num_vars_numpy(df, parameters[\"numerical_fields\"])\n\n        num_samples = len(df)\n        cat_vars = np.stack(cat_vars, 1) if len(cat_vars) else np.zeros((num_samples, 0), dtype=np.int64)\n        num_vars = np.stack(num_vars, 1) if len(num_vars) else np.zeros((num_samples, 0), dtype=np.float32)\n\n        return cat_vars, num_vars\n\n\nclass TabularDeserializer(Deserializer):\n    def __init__(self, *args, parameters: Optional[Dict[str, Any]] = None, **kwargs):\n        self._parameters = parameters\n        super().__init__(*args, **kwargs)\n\n    @property\n    def parameters(self) -> Dict[str, Any]:\n        if self._parameters is not None:\n            return self._parameters\n        parameters_state = self.get_state(TabularParametersState)\n        if parameters_state is not None and parameters_state.parameters is not None:\n            return parameters_state.parameters\n        raise MisconfigurationException(\n            \"Tabular tasks must previously have been trained in order to support serving or the `parameters` argument \"\n            \"must be provided to the `serve` method.\"\n        )\n\n    def serve_load_sample(self, data: str) -> Any:\n        parameters = self.parameters\n\n        df = read_csv(StringIO(data))\n        df = _pre_transform(\n            df,\n            parameters[\"numerical_fields\"],\n            parameters[\"categorical_fields\"],\n            parameters[\"codes\"],\n            parameters[\"mean\"],\n            parameters[\"std\"],\n        )\n\n        cat_vars = _to_cat_vars_numpy(df, parameters[\"categorical_fields\"])\n        num_vars = _to_num_vars_numpy(df, parameters[\"numerical_fields\"])\n\n        cat_vars = np.stack(cat_vars, 1)\n        num_vars = np.stack(num_vars, 1)\n\n        return [{DataKeys.INPUT: [c, n]} for c, n in zip(cat_vars, num_vars)]\n\n    @property\n    def example_input(self) -> str:\n        parameters = self.parameters\n\n        row = {}\n        for cat_col in parameters[\"categorical_fields\"]:\n            row[cat_col] = [\"test\"]\n        for num_col in parameters[\"numerical_fields\"]:\n            row[num_col] = [0]\n        return str(DataFrame.from_dict(row).to_csv())\n", "path": "flash/tabular/input.py"}]}