i have this code:
# %%
from sklearn.preprocessing import StandardScaler
import pandas as pd
import numpy as np
from tensorflow import keras
import joblib
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM,Dense,Dropout
import os

# %%
def build_lstm_model(input_shape):
    model = Sequential([
        LSTM(512, activation='relu', input_shape=input_shape, return_sequences=True),  # Adjusted for LSTM
        Dropout(0.20),
        LSTM(256, activation='relu', return_sequences=False),  # Additional LSTM layer
        Dropout(0.10),
        LSTM(128, activation='relu', return_sequences=False),  # Additional LSTM layer
        Dropout(0.10),
        Dense(128, activation='relu'),
        Dense(64, activation='relu'),
        Dense(32, activation='relu'),
        Dense(12),
    ])
    
    model.compile(optimizer='adam',
                  loss='mse',  # Use Mean Squared Error for regression
                  metrics=['mae'])  # Mean Absolute Error as an additional metric
    return model

# %%
csv_directory = r"C:\Users\arisa\Desktop\day_spot"
csv_files = [file for file in os.listdir(csv_directory) if file.endswith('.csv')]

# %%
def data_generator_lstm(file_path, x_scaler, y_scaler, n_steps):
    
    while True:
        for csv_file in csv_files:
            # Read the CSV file
            file_path = os.path.join(csv_directory, csv_file)
            chunk = pd.read_csv(file_path)
            # Drop non-numeric or non-relevant columns
            filtered_chunk = chunk.drop(['Date', 'Symbol'], axis=1)

            feature_data = filtered_chunk.drop([
                'y_High_1d', 'y_Low_1d', 'y_Priority_1d',
                 'y_High_2d', 'y_Low_2d', 'y_Priority_2d',
                  'y_High_3d', 'y_Low_3d', 'y_Priority_3d',
                   'y_High_5d', 'y_Low_5d', 'y_Priority_5d'], axis=1)
            target_data = filtered_chunk[['y_High_1d'
                   , 'y_Low_1d', 'y_Priority_1d',
                 'y_High_2d', 'y_Low_2d', 'y_Priority_2d',
                  'y_High_3d', 'y_Low_3d', 'y_Priority_3d',
                   'y_High_5d', 'y_Low_5d', 'y_Priority_5d'
                   ]]
            
            feature_data_scaled = pd.DataFrame(x_scaler.transform(feature_data), columns=feature_data.columns)
            # Assuming target_data also needs to be scaled, apply scaler separately
            target_data_scaled = pd.DataFrame(y_scaler.transform(target_data), columns=target_data.columns)
            
            # Prepare sequences for features and targets
            X, y = [], []
            for i in range(len(feature_data_scaled) - n_steps):
                X.append(feature_data_scaled[i:i + n_steps].to_numpy())  
                y.append(target_data_scaled[i + n_steps - 1].to_numpy())  

            X, y = np.array(X), np.array(y)
            yield X, y

# %%


model = build_lstm_model((30, 6427))

model.summary()




# %%

batch_size = 512

# %%
x_scaler_loaded = joblib.load('nn_x_scaler.sav')
y_scaler_loaded = joblib.load('nn_y_scaler.sav')

# %%
train_generator = data_generator_lstm(512, x_scaler_loaded, y_scaler_loaded, 30)

# Update total_samples, train_samples, and val_samples according to your dataset after transformations

model.fit(
    train_generator,
    steps_per_epoch=50,
    epochs=75,
    # Add validation_data if you have a validation generator
)





im getting following error:
{
	"name": "ValueError",
	"message": "Input 0 of layer \"lstm_15\" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 256)",
	"stack": "---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[21], line 1
----> 1 model = build_lstm_model((30, 6427))
      3 model.summary()

Cell In[19], line 2, in build_lstm_model(input_shape)
      1 def build_lstm_model(input_shape):
----> 2     model = Sequential([
      3         LSTM(512, activation='relu', input_shape=input_shape, return_sequences=True),  # Adjusted for LSTM
      4         Dropout(0.20),
      5         LSTM(256, activation='relu', return_sequences=False),  # Additional LSTM layer
      6         Dropout(0.10),
      7         LSTM(128, activation='relu', return_sequences=False),  # Additional LSTM layer
      8         Dropout(0.10),
      9         Dense(128, activation='relu'),
     10         Dense(64, activation='relu'),
     11         Dense(32, activation='relu'),
     12         Dense(12),
     13     ])
     15     model.compile(optimizer='adam',
     16                   loss='mse',  # Use Mean Squared Error for regression
     17                   metrics=['mae'])  # Mean Absolute Error as an additional metric
     18     return model

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\tensorflow\\python\\trackable\\base.py:205, in no_automatic_dependency_tracking.<locals>._method_wrapper(self, *args, **kwargs)
    203 self._self_setattr_tracking = False  # pylint: disable=protected-access
    204 try:
--> 205   result = method(self, *args, **kwargs)
    206 finally:
    207   self._self_setattr_tracking = previous_value  # pylint: disable=protected-access

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\keras\\utils\\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs)
     67     filtered_tb = _process_traceback_frames(e.__traceback__)
     68     # To get the full stack trace, call:
     69     # `tf.debugging.disable_traceback_filtering()`
---> 70     raise e.with_traceback(filtered_tb) from None
     71 finally:
     72     del filtered_tb

File c:\\Users\\arisa\\.conda\\envs\\tf\\lib\\site-packages\\keras\\engine\\input_spec.py:232, in assert_input_compatibility(input_spec, inputs, layer_name)
    230     ndim = shape.rank
    231     if ndim != spec.ndim:
--> 232         raise ValueError(
    233             f'Input {input_index} of layer \"{layer_name}\" '
    234             \"is incompatible with the layer: \"
    235             f\"expected ndim={spec.ndim}, found ndim={ndim}. \"
    236             f\"Full shape received: {tuple(shape)}\"
    237         )
    238 if spec.max_ndim is not None:
    239     ndim = x.shape.rank

ValueError: Input 0 of layer \"lstm_15\" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 256)"
}