From 61402d256bcf011e54038a67d11226efe70b7589 Mon Sep 17 00:00:00 2001 From: Henning Date: Thu, 11 May 2023 14:31:27 +0200 Subject: [PATCH] or or and --- src/transformers/models/sam/processing_sam.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/transformers/models/sam/processing_sam.py b/src/transformers/models/sam/processing_sam.py index 83356f41ee1..b5ae51d7db2 100644 --- a/src/transformers/models/sam/processing_sam.py +++ b/src/transformers/models/sam/processing_sam.py @@ -207,7 +207,7 @@ def _check_and_preprocess_points( if isinstance(input_points, torch.Tensor): input_points = input_points.numpy().tolist() - if not isinstance(input_points, list) and not isinstance(input_points[0], list): + if not isinstance(input_points, list) or not isinstance(input_points[0], list): raise ValueError("Input points must be a list of list of floating integers.") input_points = [np.array(input_point) for input_point in input_points] else: @@ -217,7 +217,7 @@ def _check_and_preprocess_points( if isinstance(input_labels, torch.Tensor): input_labels = input_labels.numpy().tolist() - if not isinstance(input_labels, list) and not isinstance(input_labels[0], list): + if not isinstance(input_labels, list) or not isinstance(input_labels[0], list): raise ValueError("Input labels must be a list of list integers.") input_labels = [np.array(label) for label in input_labels] else: @@ -229,8 +229,8 @@ def _check_and_preprocess_points( if ( not isinstance(input_boxes, list) - and not isinstance(input_boxes[0], list) - and not isinstance(input_boxes[0][0], list) + or not isinstance(input_boxes[0], list) + or not isinstance(input_boxes[0][0], list) ): raise ValueError("Input boxes must be a list of list of list of floating integers.") input_boxes = [np.array(box).astype(np.float32) for box in input_boxes]