Handling 'category' for LightGBM models

### Describe the bug

We should be able to convert some columns in the type 'category' in a DataFrame and let the LightGBM model handle it by itself.

### Steps/Code to Reproduce

```python
import pandas as pd
import numpy as np
from lightgbm import LGBMClassifier
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import FunctionTransformer

# Load data
url = "https://web.stanford.edu/class/archive/cs/cs109/cs109.1166/stuff/titanic.csv"
data = pd.read_csv(url)

# Drop Name and other non-numeric non-categorical columns
data = data.drop(columns=['Name'])

# Define a transformer to convert specific columns to category type
def convert_to_category(X):
    categorical_cols = X.select_dtypes(include=['object', 'bool']).columns.tolist()
    X[categorical_cols] = X[categorical_cols].astype('category')
    return X

# Train/test split
X_train, X_test, y_train, y_test = train_test_split(
    data.drop("Survived", axis=1), data["Survived"], random_state=42
)

# Preprocessing for numerical data: standardization and missing value imputation
numerical_transformer = Pipeline(steps=[
    ('imputer', SimpleImputer(strategy='mean')),
    ('scaler', StandardScaler())
])

# We create the preprocessor stage of final pipeline
# Each transformer is a three-element tuple
# (name, transformer, columns)
preprocessor = ColumnTransformer(
    transformers = [
        ('num', numerical_transformer, ['Pclass', 'Age', 'Siblings/Spouses Aboard', 'Parents/Children Aboard', 'Fare']),
    ],
    remainder='passthrough'  # This means unprocessed columns are dropped
)

# Convert object columns to categorical using FunctionTransformer
to_category_transformer = FunctionTransformer(func=convert_to_category, validate=False, check_inverse=False)

# Define the model 
model = LGBMClassifier()

# Bundle preprocessing and modeling code in a pipeline
clf = Pipeline(steps=[
    ('to_category', to_category_transformer),
    ('preprocessor', preprocessor),
    ('model', model)
])

# Preprocessing of training data, train model 
clf.fit(X_train, y_train)

# Preprocessing of validation data, get predictions
preds = clf.predict(X_test)

# Evaluate the model
score = accuracy_score(y_test, preds)
print('Accuracy:', score)

```

### Expected Results

Accuracy: 0.9

### Actual Results

```python-traceback
Traceback (most recent call last):
  Cell In[3], line 60
    clf.fit(X_train, y_train)
  File ~/code/scikit-learn/sklearn/base.py:1215 in wrapper
    return fit_method(estimator, *args, **kwargs)
  File ~/code/scikit-learn/sklearn/pipeline.py:468 in fit
    self._final_estimator.fit(Xt, y, **last_step_params["fit"])
  File ~/mambaforge/envs/dev/lib/python3.11/site-packages/lightgbm/sklearn.py:1142 in fit
    super().fit(
  File ~/mambaforge/envs/dev/lib/python3.11/site-packages/lightgbm/sklearn.py:770 in fit
    _X, _y = _LGBMCheckXY(X, y, accept_sparse=True, force_all_finite=False, ensure_min_samples=2)
  File ~/code/scikit-learn/sklearn/utils/validation.py:1150 in check_X_y
    X = check_array(
  File ~/code/scikit-learn/sklearn/utils/validation.py:919 in check_array
    array = _asarray_with_order(array, order=order, dtype=dtype, xp=xp)
  File ~/code/scikit-learn/sklearn/utils/_array_api.py:543 in _asarray_with_order
    array = numpy.asarray(array, order=order, dtype=dtype)
ValueError: could not convert string to float: 'male'
```

### Versions

```shell
1.2.2
```

COMMENT:
Try this:

```python
clf.set_output(transform="pandas")
clf.fit(X_train, y_train)
```

if you want to do it only for a specific pipeline without changing the global configuration of scikit-learn.

Labels: Bug