numba.core.errors.CompilerError: Failed in object mode pipeline (step: object mode frontend)

Viewed 507

I'm running my program on a server has K20 GPU, and I want to speed up the performance time by using Numba:

My code:

from numba import jit    
   @jit
    def load_data(fname):
        imagePaths = list(paths.list_images('path'+fname))
        data = []
        labels =[]
        for imagePath in imagePaths:
            label = imagePath.split(os.path.sep)[-4] # -4 --> /CP/0/3131/0.png 
            image = cv2.imread(imagePath)
            image = cv2.resize(image, (128, 128)) 
            gray = cv2. cvtColor(image, cv2.COLOR_BGR2GRAY)
            data.append(gray)
            labels.append(label)
                
        data = np.array(data) / 255.0
        labels = np.array(labels)
        lb_encoder = LabelEncoder()
        labels = lb_encoder.fit_transform(labels)
        x = data.reshape(-1,128,128,1).astype('float64')
        y = to_categorical(labels.astype('float64'))
    
        return (x, y)

But that raises the following error:

File "*/numba/core/ir_utils.py", line 2166, in enforce_no_dels
    raise CompilerError(msg, loc=dels[0].loc)
numba.core.errors.CompilerError: Failed in object mode pipeline (step: object mode frontend)
Failed in object mode pipeline (step: remove phis nodes)
Illegal IR, del found at: del $const4.1

File "Newmodel.py", line 105:
def load_data(fname):
    ^

I'm trying to use Numba because the server administrator told me to "make sure that your code is written to utilize the GPU Cuda cores"

0 Answers
Related