im getting following error:
22:19:18.216 [info] Restart requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
22:19:18.218 [warn] Cancel all remaining cells due to dead kernel
22:19:19.477 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
22:19:19.483 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-95208yFYTXnN1W1U.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
22:19:20.524 [info] Restarted 8277bb6d-9f1c-4aed-a911-2fd5d1ef7886

with following message :

The Kernel crashed while executing code in the current cell or a previous cell.
Please review the code in the cell(s) to identify a possible cause of the failure.
Click here for more info.
View Jupyter log for further details.

my code:

# %%
import pandas as pd
import datetime as dt
from datetime import date
import numpy as np
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler
import keras
import os
import joblib
from tensorflow.keras.layers import Dense, Dropout, LSTM
from tensorflow.keras.models import Sequential
import gc
import time

# %%
# gpus = tf.config.experimental.list_physical_devices(‘GPU’)
# if gpus:
# try:
# # Currently, memory growth needs to be the same across GPUs
# for gpu in gpus:
# tf.config.experimental.set_memory_growth(gpu, True)
# logical_gpus = tf.config.experimental.list_logical_devices(‘GPU’)
# print(f’{len(gpus)} Physical GPUs, {len(logical_gpus)} Logical GPUs’)
# except RuntimeError as e:
# # Memory growth must be set before GPUs have been initialized
# print(e)

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

# %%
intervals = [1,2,3,5]
look_back = 60

optimizer = keras.optimizers.Adam(learning_rate=0.0003,clipvalue=0.5)

for csv_file in csv_files:

file_path = os.path.join(csv_directory, csv_file)
unique_part = file_path.split('')[-2]

df = pd.read_csv(file_path)

include_substrings = ["y"]
exact_columns_to_keep = [“Open”, “High”, “Low”, “Close”,“volume_base”, “volume_crypto”, “tradecount”,]
filtered_columns = [col for col in df.columns if any(col.startswith(s) for s in include_substrings)]

columns_to_keep = list(set(exact_columns_to_keep + filtered_columns))
df = df[columns_to_keep]

features = df.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)


# Scale the features and targets
feature_scaler = MinMaxScaler(feature_range=(0, 1))
scaled_features = feature_scaler.fit_transform(features)

joblib.dump(feature_scaler,f’x_scalers/x{unique_part}scaler.sav’)

for p in intervals:
# Corrected to create a flat list of column names
y_cols = [f’y_High{p}d’, f’y_Low{p}d’, f’y_Priority{p}d’]
# Now you can properly index df with y_cols
targets = df[y_cols]

# Continuing with your existing code…
target_scaler = MinMaxScaler(feature_range=(0, 1))
scaled_targets = target_scaler.fit_transform(targets)
joblib.dump(target_scaler,f’y_scalers/y{p}{unique_part}scaler.sav’)

x_train = []
y_train = []

for i in range(look_back, len(scaled_features)):
x_train.append(scaled_features[i-look_back:i])
y_train.append(scaled_targets[i]) # Assuming the target is the next time step

x_train, y_train = np.array(x_train), np.array(y_train)

input_shape = (x_train.shape[1], x_train.shape[2])

model = Sequential()
model.add(LSTM(units = 100, activation = ‘tanh’, return_sequences=True))
model.add(Dropout(0.4))
model.add(LSTM(units = 240, activation = ‘tanh’))
model.add(Dropout(0.5))
model.add(Dense(units = 3))
model.compile(optimizer=optimizer, loss = ‘mean_squared_error’, metrics=[tf.keras.metrics.MeanAbsoluteError()])

model.fit(x_train, y_train,epochs = 1000)

mae = model.evaluate(x_train, y_train)

if os.path.exists(f’models/lstm_model{unique_part}y{p}mae{mae}.h5’):
milis = round(time.time() * 1000)
model.save(f’models/lstm_model{unique_part}_y{p}mae{mae}dup{milis}.h5’)
else:
model.save(f’models/lstm_model{unique_part}_y{p}mae{mae}.h5’)
# tf.keras.backend.clear_session()