admin管理员组

文章数量:1126095

I created a virtual environment and installed tensorflow 2.15.0 for my cuda version 12.2. I ran these imports here which resulted in a warning message saying this,

The imports I tried:

import os
import string
import glob
# from tensorflow.keras.applications import MobileNet
# import tensorflow.keras.applications.mobilenet

from tensorflow.keras.applications.inception_v3 import InceptionV3
import tensorflow.keras.applications.inception_v3


from tqdm import tqdm
import tensorflow.keras.preprocessing.image
import pickle
from time import time
import numpy as np
from PIL import Image
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import (LSTM, Embedding,
    TimeDistributed, Dense, RepeatVector,
    Activation, Flatten, Reshape, concatenate,
    Dropout, BatchNormalization)
from tensorflow.keras.optimizers import Adam, RMSprop
from tensorflow.keras import Input, layers
from tensorflow.keras import optimizers

from tensorflow.keras.models import Model

from tensorflow.keras.layers import add
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
import matplotlib.pyplot as plt

from tensorflow.keras.applications import EfficientNetB0, EfficientNetB7
from tensorflow.keras.models import Model
from tensorflow.keras.applications.efficientnet import preprocess_input

START = "startseq"
STOP = "endseq"
EPOCHS = 10
# USE_INCEPTION = True
USE_EFFICIENTNET = True

The warning message after I ran the above code block:

2025-01-08 15:29:40.346877: E external/local_xla/xla/stream_executor/cuda/cuda_dnn:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2025-01-08 15:29:40.346924: E external/local_xla/xla/stream_executor/cuda/cuda_fft:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2025-01-08 15:29:40.348582: E external/local_xla/xla/stream_executor/cuda/cuda_blas:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2025-01-08 15:29:40.356103: I tensorflow/core/platform/cpu_feature_guard:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2025-01-08 15:29:41.009013: W tensorflow/compiler/tf2tensorrt/utils/py_utils:38] TF-TRT Warning: Could not find TensorRT

But still I carried on and when I executed this code block I faced the error which was saying, JIT Compilation failed. Here's the code block followed by the full error message,

The code block:

%%time
# Encode and save training pairs
train_path = os.path.join(data_dir, f"trainmultiImage{OUTPUT_DIM}_exp2.pkl")

# Encode and save training pairs
if not os.path.exists(train_path):
    encoding_train = {}
    for pre_img, post_img in tqdm(train_pairs):
        pre_path = os.path.join(pre_disaster_dir, pre_img)
        post_path = os.path.join(post_disaster_dir, post_img)

        # Load and encode concatenated pre- and post-disaster images
        concatenated_encoded = encodeConcatenatedImage(pre_path, post_path)

        encoding_train[(pre_img, post_img)] = concatenated_encoded

    with open(train_path, "wb") as fp:
        pickle.dump(encoding_train, fp)
    print(f"Training set encoded and saved: {train_path}")
else:
    with open(train_path, "rb") as fp:
        encoding_train = pickle.load(fp)

The complete error:

 0%|                                                                                | 0/5732 [00:00<?, ?it/s]2025-01-08 22:27:29.771082: W tensorflow/core/framework/op_kernel:1827] UNKNOWN: JIT compilation failed.
  0%|                                                                                | 0/5732 [00:00<?, ?it/s]
---------------------------------------------------------------------------
UnknownError                              Traceback (most recent call last)
File <timed exec>:12

Cell In[45], line 10, in encodeConcatenatedImage(pre_image_path, post_image_path)
      8 x = np.expand_dims(x, axis=0)
      9 x = preprocess_input(x)
---> 10 x = encode_model.predict(x)  # Get the encoding vector for the concatenated image
     11 x = np.reshape(x, OUTPUT_DIM)
     12 return x

File ~/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/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 ~/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/tensorflow/python/eager/execute.py:53, in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     51 try:
     52   ctx.ensure_initialized()
---> 53   tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     54                                       inputs, attrs, num_outputs)
     55 except core._NotOkStatusException as e:
     56   if name is not None:

UnknownError: Graph execution error:

Detected at node efficientnetb7/normalization_2/Sqrt defined at (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main

  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel_launcher.py", line 18, in <module>

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/traitlets/config/application.py", line 1075, in launch_instance

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 739, in start

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 205, in start

  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever

  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once

  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 545, in dispatch_queue

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 534, in process_one

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 437, in dispatch_shell

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 362, in execute_request

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 778, in execute_request

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 449, in do_execute

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/ipykernel/zmqshell.py", line 549, in run_cell

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3075, in run_cell

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3130, in _run_cell

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/async_helpers.py", line 128, in _pseudo_sync_runner

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3334, in run_cell_async

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3517, in run_ast_nodes

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code

  File "/tmp/ipykernel_592325/1759323409.py", line 1, in <module>

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2541, in run_cell_magic

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/IPython/core/magics/execution.py", line 1350, in time

  File "<timed exec>", line 12, in <module>

  File "/tmp/ipykernel_592325/964428598.py", line 10, in encodeConcatenatedImage

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 2655, in predict

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 2440, in predict_function

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 2425, in step_function

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 2413, in run_step

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 2381, in predict_step

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/training.py", line 590, in __call__

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/base_layer.py", line 1149, in __call__

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/functional.py", line 515, in call

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/functional.py", line 672, in _run_internal_graph

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 65, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/engine/base_layer.py", line 1149, in __call__

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 96, in error_handler

  File "/home/mohdariful_haque/ws/YOLO_Project/xBD_training/fourClassTraining/custom_env/lib/python3.10/site-packages/keras/src/layers/preprocessing/normalization.py", line 363, in call

JIT compilation failed.
     [[{{node efficientnetb7/normalization_2/Sqrt}}]] [Op:__inference_predict_function_50185]

I have never encountered an error like this before and have not found any specific solutions regarding deep learning-related problems. What can I do to resolve this error?

I already tried creating a new virtual environment but this same problem persisted.

本文标签: