im getting following error:
Visual Studio Code (1.88.1, undefined, desktop)
Jupyter Extension Version: 2024.3.1.
Python Extension Version: 2024.4.1.
Pylance Extension Version: 2024.4.1.
Platform: win32 (x64).
Workspace folder ~\Desktop\Stock-Price-Prediction-Using-LSTM-main, Home = c:\Users\arisa
13:54:57.957 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0436411c074290f12765d02881f33b31f4740c9f9e514b7051a62a818066633e1.~\.conda\envs\tf\python.exe.~\.conda\envs\tf\python.exe.-m#ipykernel_launcher  (Python Path: ~\.conda\envs\tf\python.exe, Conda, tf (Python 3.9.19), 3.9.19) for '~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb' (disableUI=true)
13:55:01.064 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
13:55:01.071 [info] Process Execution: ~\.conda\envs\tf\python.exe ~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\pythonFiles\vscode_datascience_helpers\kernel_interrupt_daemon.py --ppid 9520
    > cwd: ~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\pythonFiles\vscode_datascience_helpers
13:55:01.082 [info] Process Execution: ~\.conda\envs\tf\python.exe -m pip list
13:55:01.206 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-95206eUXcaYB7uSI.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
13:55:02.434 [info] Process Execution: ~\.conda\envs\tf\python.exe ~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\pythonFiles\printJupyterDataDir.py
13:55:02.509 [warn] Got a non-existent Jupyter Data Dir file:///c%3A/Users/<username>/AppData/Roaming/Python/share/jupyter
13:55:55.066 [info] Execution of code ms-toolsai.jupyter-1 completed in 27ms
13:57:44.436 [info] Execution of code ms-toolsai.jupyter-2 completed in 17ms
13:57:52.276 [info] Execution of code ms-toolsai.jupyter-3 completed in 18ms
13:57:53.027 [info] Execution of code ms-toolsai.jupyter-4 completed in 17ms
13:57:53.118 [info] Execution of code ms-toolsai.jupyter-5 completed in 17ms
13:57:59.272 [info] Restart requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
13:57:59.277 [info] Process Execution: c:\Windows\System32\taskkill.exe /F /T /PID 20972
13:57:59.284 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
13:57:59.335 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-9520thkWsR6h6ohm.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
13:58:00.169 [info] Restarted 8277bb6d-9f1c-4aed-a911-2fd5d1ef7886
13:58:01.320 [info] Handle Execution of Cells 0,1,2,3 for ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
13:58:04.339 [info] Cell 0 completed in 3.012s (start: 1713733081327, end: 1713733084339)
13:58:04.486 [warn] StdErr from Kernel Process 2024-04-21 13:58:04.486714: I tensorflow/core/platform/cpu_feature_guard.cc:193] This
13:58:04.486 [warn] StdErr from Kernel Process TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
13:58:05.042 [warn] StdErr from Kernel Process 2024-04-21 13:58:05.042950: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device
13:58:05.043 [warn] StdErr from Kernel Process /job:localhost/replica:0/task:0/device:GPU:0 with 5450 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:41:00.0, compute capability: 8.6
13:58:05.051 [info] Cell 1 completed in 0.626s (start: 1713733084425, end: 1713733085051)
13:58:05.068 [info] Cell 2 completed in 0.01s (start: 1713733085057, end: 1713733085067)
13:58:08.767 [warn] StdErr from Kernel Process 2024-04-21 13:58:08.767571: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8100
13:58:09.574 [warn] StdErr from Kernel Process 2024-04-21 13:58:09.574465: I tensorflow/stream_executor/cuda/cuda_blas.cc:1614] TensorFloat-32 will be used for the ma
13:58:09.574 [warn] StdErr from Kernel Process trix multiplication. This will only be logged once.
14:11:10.753 [warn] Cell completed with errors [hd [Error]: Unable to synchronously create dataset (name already exists)
	at r.execute (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:327:4943)] {
  ename: 'ValueError',
  evalue: 'Unable to synchronously create dataset (name already exists)',
  traceback: [
    '\x1B[1;31m---------------------------------------------------------------------------\x1B[0m',
    '\x1B[1;31mValueError\x1B[0m                                Traceback (most recent call last)',
    'Cell \x1B[1;32mIn[4], line 71\x1B[0m\n' +
      "\x1B[0;32m     69\x1B[0m     model\x1B[38;5;241m.\x1B[39msave(\x1B[38;5;124mf\x1B[39m\x1B[38;5;124m'\x1B[39m\x1B[38;5;124mmodels/lstm_model_\x1B[39m\x1B[38;5;132;01m{\x1B[39;00munique_part\x1B[38;5;132;01m}\x1B[39;00m\x1B[38;5;124m_y\x1B[39m\x1B[38;5;132;01m{\x1B[39;00mp\x1B[38;5;132;01m}\x1B[39;00m\x1B[38;5;124m_mae_\x1B[39m\x1B[38;5;132;01m{\x1B[39;00mmae\x1B[38;5;132;01m}\x1B[39;00m\x1B[38;5;124m_dup\x1B[39m\x1B[38;5;132;01m{\x1B[39;00mmilis\x1B[38;5;132;01m}\x1B[39;00m\x1B[38;5;124m.h5\x1B[39m\x1B[38;5;124m'\x1B[39m)\n" +
      '\x1B[0;32m     70\x1B[0m \x1B[38;5;28;01melse\x1B[39;00m:\n' +
      "\x1B[1;32m---> 71\x1B[0m     \x1B[43mmodel\x1B[49m\x1B[38;5;241;43m.\x1B[39;49m\x1B[43msave\x1B[49m\x1B[43m(\x1B[49m\x1B[38;5;124;43mf\x1B[39;49m\x1B[38;5;124;43m'\x1B[39;49m\x1B[38;5;124;43mmodels/lstm_model_\x1B[39;49m\x1B[38;5;132;43;01m{\x1B[39;49;00m\x1B[43munique_part\x1B[49m\x1B[38;5;132;43;01m}\x1B[39;49;00m\x1B[38;5;124;43m_y\x1B[39;49m\x1B[38;5;132;43;01m{\x1B[39;49;00m\x1B[43mp\x1B[49m\x1B[38;5;132;43;01m}\x1B[39;49;00m\x1B[38;5;124;43m_mae_\x1B[39;49m\x1B[38;5;132;43;01m{\x1B[39;49;00m\x1B[43mmae\x1B[49m\x1B[38;5;132;43;01m}\x1B[39;49;00m\x1B[38;5;124;43m.h5\x1B[39;49m\x1B[38;5;124;43m'\x1B[39;49m\x1B[43m)\x1B[49m\n" +
      '\x1B[0;32m     72\x1B[0m tf\x1B[38;5;241m.\x1B[39mkeras\x1B[38;5;241m.\x1B[39mbackend\x1B[38;5;241m.\x1B[39mclear_session() \n',
    'File \x1B[1;32mc:\\Users\\<username>\\.conda\\envs\\tf\\lib\\site-packages\\keras\\utils\\traceback_utils.py:70\x1B[0m, in \x1B[0;36mfilter_traceback.<locals>.error_handler\x1B[1;34m(*args, **kwargs)\x1B[0m\n' +
      '\x1B[0;32m     67\x1B[0m     filtered_tb \x1B[38;5;241m=\x1B[39m _process_traceback_frames(e\x1B[38;5;241m.\x1B[39m__traceback__)\n' +
      '\x1B[0;32m     68\x1B[0m     \x1B[38;5;66;03m# To get the full stack trace, call:\x1B[39;00m\n' +
      '\x1B[0;32m     69\x1B[0m     \x1B[38;5;66;03m# `tf.debugging.disable_traceback_filtering()`\x1B[39;00m\n' +
      '\x1B[1;32m---> 70\x1B[0m     \x1B[38;5;28;01mraise\x1B[39;00m e\x1B[38;5;241m.\x1B[39mwith_traceback(filtered_tb) \x1B[38;5;28;01mfrom\x1B[39;00m \x1B[38;5;28;01mNone\x1B[39;00m\n' +
      '\x1B[0;32m     71\x1B[0m \x1B[38;5;28;01mfinally\x1B[39;00m:\n' +
      '\x1B[0;32m     72\x1B[0m     \x1B[38;5;28;01mdel\x1B[39;00m filtered_tb\n',
    'File \x1B[1;32mc:\\Users\\<username>\\.conda\\envs\\tf\\lib\\site-packages\\h5py\\_hl\\group.py:183\x1B[0m, in \x1B[0;36mGroup.create_dataset\x1B[1;34m(self, name, shape, dtype, data, **kwds)\x1B[0m\n' +
      "\x1B[0;32m    180\x1B[0m         parent_path, name \x1B[38;5;241m=\x1B[39m name\x1B[38;5;241m.\x1B[39mrsplit(\x1B[38;5;124mb\x1B[39m\x1B[38;5;124m'\x1B[39m\x1B[38;5;124m/\x1B[39m\x1B[38;5;124m'\x1B[39m, \x1B[38;5;241m1\x1B[39m)\n" +
      '\x1B[0;32m    181\x1B[0m         group \x1B[38;5;241m=\x1B[39m \x1B[38;5;28mself\x1B[39m\x1B[38;5;241m.\x1B[39mrequire_group(parent_path)\n' +
      '\x1B[1;32m--> 183\x1B[0m dsid \x1B[38;5;241m=\x1B[39m dataset\x1B[38;5;241m.\x1B[39mmake_new_dset(group, shape, dtype, data, name, \x1B[38;5;241m*\x1B[39m\x1B[38;5;241m*\x1B[39mkwds)\n' +
      '\x1B[0;32m    184\x1B[0m dset \x1B[38;5;241m=\x1B[39m dataset\x1B[38;5;241m.\x1B[39mDataset(dsid)\n' +
      '\x1B[0;32m    185\x1B[0m \x1B[38;5;28;01mreturn\x1B[39;00m dset\n',
    'File \x1B[1;32mc:\\Users\\<username>\\.conda\\envs\\tf\\lib\\site-packages\\h5py\\_hl\\dataset.py:163\x1B[0m, in \x1B[0;36mmake_new_dset\x1B[1;34m(parent, shape, dtype, data, name, chunks, compression, shuffle, fletcher32, maxshape, compression_opts, fillvalue, scaleoffset, track_times, external, track_order, dcpl, dapl, efile_prefix, virtual_prefix, allow_unknown_filter, rdcc_nslots, rdcc_nbytes, rdcc_w0)\x1B[0m\n' +
      '\x1B[0;32m    160\x1B[0m \x1B[38;5;28;01melse\x1B[39;00m:\n' +
      '\x1B[0;32m    161\x1B[0m     sid \x1B[38;5;241m=\x1B[39m h5s\x1B[38;5;241m.\x1B[39mcreate_simple(shape, maxshape)\n' +
      '\x1B[1;32m--> 163\x1B[0m dset_id \x1B[38;5;241m=\x1B[39m \x1B[43mh5d\x1B[49m\x1B[38;5;241;43m.\x1B[39;49m\x1B[43mcreate\x1B[49m\x1B[43m(\x1B[49m\x1B[43mparent\x1B[49m\x1B[38;5;241;43m.\x1B[39;49m\x1B[43mid\x1B[49m\x1B[43m,\x1B[49m\x1B[43m \x1B[49m\x1B[43mname\x1B[49m\x1B[43m,\x1B[49m\x1B[43m \x1B[49m\x1B[43mtid\x1B[49m\x1B[43m,\x1B[49m\x1B[43m \x1B[49m\x1B[43msid\x1B[49m\x1B[43m,\x1B[49m\x1B[43m \x1B[49m\x1B[43mdcpl\x1B[49m\x1B[38;5;241;43m=\x1B[39;49m\x1B[43mdcpl\x1B[49m\x1B[43m,\x1B[49m\x1B[43m \x1B[49m\x1B[43mdapl\x1B[49m\x1B[38;5;241;43m=\x1B[39;49m\x1B[43mdapl\x1B[49m\x1B[43m)\x1B[49m\n' +
      '\x1B[0;32m    165\x1B[0m \x1B[38;5;28;01mif\x1B[39;00m (data \x1B[38;5;129;01mis\x1B[39;00m \x1B[38;5;129;01mnot\x1B[39;00m \x1B[38;5;28;01mNone\x1B[39;00m) \x1B[38;5;129;01mand\x1B[39;00m (\x1B[38;5;129;01mnot\x1B[39;00m \x1B[38;5;28misinstance\x1B[39m(data, Empty)):\n' +
      '\x1B[0;32m    166\x1B[0m     dset_id\x1B[38;5;241m.\x1B[39mwrite(h5s\x1B[38;5;241m.\x1B[39mALL, h5s\x1B[38;5;241m.\x1B[39mALL, data)\n',
    'File \x1B[1;32mh5py\\\\_objects.pyx:54\x1B[0m, in \x1B[0;36mh5py._objects.with_phil.wrapper\x1B[1;34m()\x1B[0m\n',
    'File \x1B[1;32mh5py\\\\_objects.pyx:55\x1B[0m, in \x1B[0;36mh5py._objects.with_phil.wrapper\x1B[1;34m()\x1B[0m\n',
    'File \x1B[1;32mh5py\\\\h5d.pyx:137\x1B[0m, in \x1B[0;36mh5py.h5d.create\x1B[1;34m()\x1B[0m\n',
    '\x1B[1;31mValueError\x1B[0m: Unable to synchronously create dataset (name already exists)'
  ]
}
14:11:10.756 [info] Cell 3 completed in 785.672s (start: 1713733085081, end: 1713733870753)
14:12:33.624 [info] Restart requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:12:33.630 [info] Process Execution: c:\Windows\System32\taskkill.exe /F /T /PID 20412
14:12:34.891 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:12:34.896 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-9520AY5NlkvQg6rr.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
14:12:35.726 [info] Restarted 8277bb6d-9f1c-4aed-a911-2fd5d1ef7886
14:12:38.591 [info] Handle Execution of Cells 0,1,2,3 for ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:12:41.626 [info] Cell 0 completed in 3.027s (start: 1713733958598, end: 1713733961625)
14:12:41.642 [info] Cell 1 completed in 0.011s (start: 1713733961631, end: 1713733961642)
14:12:41.749 [info] Cell 2 completed in 0.099s (start: 1713733961650, end: 1713733961749)
14:12:41.846 [warn] StdErr from Kernel Process 2024-04-21 14:12:41.846363: I tensorflow/core/platform/cpu_feat
14:12:41.846 [warn] StdErr from Kernel Process ure_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
14:12:42.382 [warn] StdErr from Kernel Process 2024-04-21 14:12:42.382738: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /job:localhost/repli
14:12:42.383 [warn] StdErr from Kernel Process ca:0/task:0/device:GPU:0 with 5450 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:41:00.0, compute capability: 8.6
14:12:46.152 [warn] StdErr from Kernel Process 2024-04-21 14:12:46.152691: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN ve
14:12:46.153 [warn] StdErr from Kernel Process rsion 8100
14:12:46.946 [warn] StdErr from Kernel Process 2024-04-21 14:12:46.946404: I tensorflow/stream_executor/cuda/cuda_blas.cc:1614] TensorFloat-32 will be used for the matrix multiplication. This will only be logged once.
14:13:33.804 [info] Interrupt kernel execution
14:13:33.804 [info] Interrupt requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:13:33.804 [info] Interrupt kernel execution
14:13:33.805 [info] Interrupting kernel: python3919jvsc74a57bd0436411c074290f12765d02881f33b31f4740c9f9e514b7051a62a818066633e1
14:13:33.805 [info] Interrupting kernel via custom event (Win32)
14:13:36.107 [warn] Cell completed with errors (cancelled)
14:13:36.107 [info] Cell 3 completed in 54.344s (start: 1713733961763, end: 1713734016107)
14:13:36.110 [info] Interrupt requested & sent for ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb in notebookEditor.
14:13:36.988 [info] Restart requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:13:36.992 [info] Process Execution: c:\Windows\System32\taskkill.exe /F /T /PID 20856
14:13:36.997 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:13:37.046 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-9520HyVFTdhDvtwf.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
14:13:37.894 [info] Restarted 8277bb6d-9f1c-4aed-a911-2fd5d1ef7886
14:13:48.774 [info] Restart requested ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:13:48.778 [info] Process Execution: c:\Windows\System32\taskkill.exe /F /T /PID 18136
14:13:48.782 [info] Process Execution: ~\.conda\envs\tf\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:13:48.823 [info] Process Execution: ~\.conda\envs\tf\python.exe -m ipykernel_launcher --f=~\AppData\Roaming\jupyter\runtime\kernel-v2-9520MJuNGKTNxnU3.json
    > cwd: ~\Desktop\Stock-Price-Prediction-Using-LSTM-main
14:13:49.643 [info] Restarted 8277bb6d-9f1c-4aed-a911-2fd5d1ef7886
14:13:51.211 [info] Handle Execution of Cells 0,1,2,3 for ~\Desktop\Stock-Price-Prediction-Using-LSTM-main\lastm_all.ipynb
14:13:54.264 [info] Cell 0 completed in 3.047s (start: 1713734031217, end: 1713734034264)
14:13:54.280 [info] Cell 1 completed in 0.01s (start: 1713734034270, end: 1713734034280)
14:13:54.373 [info] Cell 2 completed in 0.086s (start: 1713734034286, end: 1713734034372)
14:13:54.474 [warn] StdErr from Kernel Process 2024-04-21 14:13:54.475208: I tensorflow/core/platform/cpu_feature_guard.cc:193]
14:13:54.474 [warn] StdErr from Kernel Process This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
14:13:55.021 [warn] StdErr from Kernel Process 2024-04-21 14:13:55.022493: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1
14:13:55.022 [warn] StdErr from Kernel Process 616] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 5450 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:41:00.0, compute capability: 8.6
14:13:58.812 [warn] StdErr from Kernel Process 2024-04-21 14:13:58.812991: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 81
14:13:58.812 [warn] StdErr from Kernel Process 00
14:13:59.659 [warn] StdErr from Kernel Process 2024-04-21 14:13:59.660253: I tensorflow/stream_executor/cuda/cuda_blas.cc:1614] T
14:13:59.659 [warn] StdErr from Kernel Process ensorFloat-32 will be used for the matrix multiplication. This will only be logged once.
15:30:11.012 [warn] StdErr from Kernel Process 2024-04-21 15:30:11.019164: F .\tensorflow/core/kernels/conv_2d_gpu.h:1028] Non-OK-status: Gpu
15:30:11.012 [warn] StdErr from Kernel Process LaunchKernel( SwapDimension1And2InTensor3UsingTiles<T, kNumThreads, kTileSize, kTileSize, conjugate>, total_tiles_count, kNumThreads, 0, d.stream(), input, input_dims, output) status: INTERNAL: an illegal memory access was encountered
2024-04-21 15:30:11.019529: F tensorflow/core/kernels/training_ops_gpu.cu.c
15:30:11.595 [error] Disposing session as kernel process died ExitCode: 3221226505, Reason: 2024-04-21 14:13:54.475208: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-04-21 14:13:55.022493: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1616] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 5450 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:41:00.0, compute capability: 8.6
2024-04-21 14:13:58.812991: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8100
2024-04-21 14:13:59.660253: I tensorflow/stream_executor/cuda/cuda_blas.cc:1614] TensorFloat-32 will be used for the matrix multiplication. This will only be logged once.
2024-04-21 15:30:11.019164: F .\tensorflow/core/kernels/conv_2d_gpu.h:1028] Non-OK-status: GpuLaunchKernel( SwapDimension1And2InTensor3UsingTiles<T, kNumThreads, kTileSize, kTileSize, conjugate>, total_tiles_count, kNumThreads, 0, d.stream(), input, input_dims, output) status: INTERNAL: an illegal memory access was encountered
2024-04-21 15:30:11.019529: F tensorflow/core/kernels/training_ops_gpu.cu.c
15:30:11.615 [info] Cell 3 completed in -1713734034.387s (start: 1713734034387, end: undefined)


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()