def helper_fit_predict(
        predict_n, ts_train, ts_val, past_covariates, future_covariates, kwargs_tft
    ):
        """simple helper that returns prediction for the individual test cases"""
        model = TFTModel(**kwargs_tft)

        model.fit(
            ts_train,
            past_covariates=past_covariates,
            future_covariates=future_covariates,
            val_series=ts_val,
            val_past_covariates=past_covariates,
            val_future_covariates=future_covariates,
            verbose=False,
        )

        series = None if isinstance(ts_train, TimeSeries) else ts_train
        y_hat = model.predict(
            n=predict_n,
            series=series,
            past_covariates=past_covariates,
            future_covariates=future_covariates,
            num_samples=(100 if model.supports_probabilistic_prediction else 1),
        )

        if isinstance(y_hat, TimeSeries):
            y_hat = y_hat.quantile_timeseries(0.5) if y_hat.n_samples > 1 else y_hat
        else:
            y_hat = [
                ts.quantile_timeseries(0.5) if ts.n_samples > 1 else ts for ts in y_hat
            ]
        return y_hat
simple helper that returns prediction for the individual test cases
darts/tests/models/forecasting/test_TFT.py