Prepare `inputs` before feeding them to the model, converting them to tensors if they are not already and handling potential state.
(self, inputs: dict[str, torch.Tensor | Any])
| 2201 | return data |
| 2202 | |
| 2203 | def _prepare_inputs(self, inputs: dict[str, torch.Tensor | Any]) -> dict[str, torch.Tensor | Any]: |
| 2204 | """ |
| 2205 | Prepare `inputs` before feeding them to the model, converting them to tensors if they are not already and |
| 2206 | handling potential state. |
| 2207 | """ |
| 2208 | inputs = self._prepare_input(inputs) |
| 2209 | if len(inputs) == 0: |
| 2210 | raise ValueError( |
| 2211 | "The batch received was empty, your model won't be able to train on it. Double-check that your " |
| 2212 | f"training dataset contains keys expected by the model: {','.join(self._signature_columns)}." |
| 2213 | ) |
| 2214 | |
| 2215 | return inputs |
| 2216 | |
| 2217 | def _prepare_context_parallel_inputs( |
| 2218 | self, model: nn.Module, inputs: dict[str, torch.Tensor | Any] |
no test coverage detected