Skip to content

Commit

Permalink
OR am I crazy? (huggingface#23295)
Browse files Browse the repository at this point in the history
or or and
  • Loading branch information
hwuebben authored and novice03 committed Jun 23, 2023
1 parent 9bb3b64 commit 28592c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/transformers/models/sam/processing_sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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]
Expand Down

0 comments on commit 28592c4

Please sign in to comment.