Проверь код. Он должен работать на GPU:
import cv2
import mediapipe as mp
import pandas as pd
import torch

class HandDetector:
    def __init__(self, mode=False, maxHands=2, modelComplexity=1, detectionCon=0.7, trackCon=0.7, device='cuda'):
        # self.device = torch.device(device if torch.cuda.is_available() else 'cpu')
        self.device = torch.device("mps")
        self.mode = mode
        self.maxHands = maxHands
        self.modelComplex = modelComplexity
        self.detectionCon = detectionCon
        self.trackCon = trackCon

        self.mpHands = mp.solutions.hands
        self.hands = self.mpHands.Hands(self.mode, self.maxHands, self.modelComplex, 
                                        self.detectionCon, self.trackCon)
        self.mpDraw = mp.solutions.drawing_utils

        self.columns_names = ['x_left_0', 'x_left_1','x_left_2','x_left_3','x_left_4','x_left_5','x_left_6','x_left_7','x_left_8','x_left_9','x_left_10',
               'x_left_11','x_left_12','x_left_13','x_left_14','x_left_15','x_left_16','x_left_17','x_left_18','x_left_19','x_left_20',
               
               'y_left_0', 'y_left_1','y_left_2','y_left_3','y_left_4','y_left_5','y_left_6','y_left_7','y_left_8','y_left_9','y_left_10',
               'y_left_11','y_left_12','y_left_13','y_left_14','y_left_15','y_left_16','y_left_17','y_left_18','y_left_19','y_left_20',

               'x_right_0', 'x_right_1','x_right_2','x_right_3','x_right_4','x_right_5','x_right_6','x_right_7','x_right_8','x_right_9','x_right_10',
               'x_right_11','x_right_12','x_right_13','x_right_14','x_right_15','x_right_16','x_right_17','x_right_18','x_right_19','x_right_20',
               
               'y_right_0', 'y_right_1','y_right_2','y_right_3','y_right_4','y_right_5','y_right_6','y_right_7','y_right_8','y_right_9','y_right_10',
               'y_right_11','y_right_12','y_right_13','y_right_14','y_right_15','y_right_16','y_right_17','y_right_18','y_right_19','y_right_20']
    
        self.x_left_columns = ['x_left_0', 'x_left_1','x_left_2','x_left_3','x_left_4','x_left_5','x_left_6','x_left_7','x_left_8','x_left_9','x_left_10',
               'x_left_11','x_left_12','x_left_13','x_left_14','x_left_15','x_left_16','x_left_17','x_left_18','x_left_19','x_left_20']
        
        self.y_left_columns = ['y_left_0', 'y_left_1','y_left_2','y_left_3','y_left_4','y_left_5','y_left_6','y_left_7','y_left_8','y_left_9','y_left_10',
               'y_left_11','y_left_12','y_left_13','y_left_14','y_left_15','y_left_16','y_left_17','y_left_18','y_left_19','y_left_20']
        
        self.x_right_columns = ['x_right_0', 'x_right_1','x_right_2','x_right_3','x_right_4','x_right_5','x_right_6','x_right_7','x_right_8','x_right_9','x_right_10',
               'x_right_11','x_right_12','x_right_13','x_right_14','x_right_15','x_right_16','x_right_17','x_right_18','x_right_19','x_right_20']
        
        self.y_right_columns = ['y_right_0', 'y_right_1','y_right_2','y_right_3','y_right_4','y_right_5','y_right_6','y_right_7','y_right_8','y_right_9','y_right_10',
               'y_right_11','y_right_12','y_right_13','y_right_14','y_right_15','y_right_16','y_right_17','y_right_18','y_right_19','y_right_20']
        

        self.df_classification = pd.DataFrame(columns=self.columns_names)
    
    def findHands(self, img, draw=True):
        imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

        # Для работы с GPU используем торч тензоры
        imgTensor = torch.tensor(imgRGB, dtype=torch.float32).to(self.device)

        self.results = self.hands.process(imgRGB)  # В данный момент, медиапайп только на CPU

        if self.results.multi_hand_landmarks:
            for handLms in self.results.multi_hand_landmarks:
                if draw:
                    self.mpDraw.draw_landmarks(img, handLms, self.mpHands.HAND_CONNECTIONS)
        return img

    def findPosition(self, img, draw=True):   
        left_hand_lmlist = [] 
        right_hand_lmlist = []

        if self.results.multi_hand_landmarks:
            if draw:
                self.mpDraw.draw_landmarks(img, self.results.multi_hand_landmarks[0], self.mpHands.HAND_CONNECTIONS)
            for handLms, hand_handedness in zip(self.results.multi_hand_landmarks, self.results.multi_handedness):   
                if hand_handedness.classification[0].label == 'Left':
                    lmlist = []
                    for id, lm in enumerate(handLms.landmark):
                        h, w, c = img.shape
                        cx, cy = int(lm.x * w), int(lm.y * h)
                        lmlist.append([id, cx, cy])
                    left_hand_lmlist = lmlist

                elif hand_handedness.classification[0].label == 'Right':
                    lmlist = []
                    for id, lm in enumerate(handLms.landmark):
                        h, w, c = img.shape
                        cx, cy = int(lm.x * w), int(lm.y * h)
                        lmlist.append([id, cx, cy])
                    right_hand_lmlist = lmlist

        else:
            lmlist = []
            for id in range(0,21):
                lmlist.append([id, 0, 0])
            left_hand_lmlist = lmlist
            right_hand_lmlist = lmlist

        if len(left_hand_lmlist) == 0:
            for id in range(0,21):
                left_hand_lmlist.append([id, 0, 0])

        if len(right_hand_lmlist) == 0:
            for id in range(0,21):
                right_hand_lmlist.append([id, 0, 0])
                    
        return left_hand_lmlist, right_hand_lmlist

    def process_landmark(self, lm, shape):
        h, w, c = shape
        cx, cy = int(lm.x * w), int(lm.y * h)
        return [lm.id, cx, cy]

    def savePosition(self, left_hand_lmlist, right_hand_lmlist, x_left_column_names, y_left_column_names, x_right_column_names, y_right_column_names):
        x_left = [point[1] for point in left_hand_lmlist]
        y_left = [point[2] for point in left_hand_lmlist]
        x_right = [point[1] for point in right_hand_lmlist]
        y_right = [point[2] for point in right_hand_lmlist]

        df_x_left = pd.DataFrame(x_left).T
        df_x_left.columns = x_left_column_names[:len(x_left)]

        df_y_left = pd.DataFrame(y_left).T
        df_y_left.columns = y_left_column_names[:len(y_left)]

        df_x_right = pd.DataFrame(x_right).T
        df_x_right.columns = x_right_column_names[:len(x_right)]

        df_y_right = pd.DataFrame(y_right).T
        df_y_right.columns = y_right_column_names[:len(y_right)]
    
        df_hands = pd.concat([df_x_left,df_y_left,df_x_right,df_y_right], axis=1)
        return df_hands