code: def test_small_model_pt(self):
      object_detector = pipeline(
          "zero-shot-object-detection",
          model="hf-internal-testing/tiny-random-owlvit-object-detection",
      )
  
      outputs = object_detector(
          "./tests/fixtures/tests_samples/COCO/000000039769.png",
          text_queries=["cat", "remote", "couch"],
          threshold=0.64,
      )
  
      self.assertEqual(
          nested_simplify(outputs, decimals=4),
          [
              [
                  {
                      "score": 0.7235,
                      "label": "cat",
                      "box": {
                          "xmin": 204,
                          "ymin": 167,
                          "xmax": 232,
                          "ymax": 190,
                      },
                  },
                  {
                      "score": 0.6748,
                      "label": "remote",
                      "box": {
                          "xmin": 571,
                          "ymin": 83,
                          "xmax": 598,
                          "ymax": 103,
                      },
                  },
                  {
                      "score": 0.6456,
                      "label": "remote",
                      "box": {
                          "xmin": 494,
                          "ymin": 105,
                          "xmax": 521,
                          "ymax": 127,
                      },
                  },
                  {
                      "score": 0.642,
                      "label": "remote",
                      "box": {
                          "xmin": 67,
                          "ymin": 274,
                          "xmax": 93,
                          "ymax": 297,
                      },
                  },
              ]
          ],
      )
  
      outputs = object_detector(
          ["./tests/fixtures/tests_samples/COCO/000000039769.png"],
          text_queries=["cat", "remote", "couch"],
          threshold=0.64,
      )
  
      self.assertEqual(
          nested_simplify(outputs, decimals=4),
          [
              [
                  {
                      "score": 0.7235,
                      "label": "cat",
                      "box": {
                          "xmin": 204,
                          "ymin": 167,
                          "xmax": 232,
                          "ymax": 190,
                      },
                  },
                  {
                      "score": 0.6748,
                      "label": "remote",
                      "box": {
                          "xmin": 571,
                          "ymin": 83,
                          "xmax": 598,
                          "ymax": 103,
                      },
                  },
                  {
                      "score": 0.6456,
                      "label": "remote",
                      "box": {
                          "xmin": 494,
                          "ymin": 105,
                          "xmax": 521,
                          "ymax": 127,
                      },
                  },
                  {
                      "score": 0.642,
                      "label": "remote",
                      "box": {
                          "xmin": 67,
                          "ymin": 274,
                          "xmax": 93,
                          "ymax": 297,
                      },
                  },
              ]
          ],
      )
  
      outputs = object_detector(
          "./tests/fixtures/tests_samples/COCO/000000039769.png",
          text_queries=[["cat", "remote", "couch"]],
          threshold=0.64,
      )
  
      self.assertEqual(
          nested_simplify(outputs, decimals=4),
          [
              [
                  {
                      "score": 0.7235,
                      "label": "cat",
                      "box": {
                          "xmin": 204,
                          "ymin": 167,
                          "xmax": 232,
                          "ymax": 190,
                      },
                  },
                  {
                      "score": 0.6748,
                      "label": "remote",
                      "box": {
                          "xmin": 571,
                          "ymin": 83,
                          "xmax": 598,
                          "ymax": 103,
                      },
                  },
                  {
                      "score": 0.6456,
                      "label": "remote",
                      "box": {
                          "xmin": 494,
                          "ymin": 105,
                          "xmax": 521,
                          "ymax": 127,
                      },
                  },
                  {
                      "score": 0.642,
                      "label": "remote",
                      "box": {
                          "xmin": 67,
                          "ymin": 274,
                          "xmax": 93,
                          "ymax": 297,
                      },
                  },
              ]
          ],
      )
  
      outputs = object_detector(
          [
              "./tests/fixtures/tests_samples/COCO/000000039769.png",
              "http://images.cocodataset.org/val2017/000000039769.jpg",
          ],
          text_queries=[
              ["cat", "remote", "couch"],
              ["cat", "remote", "couch"],
          ],
          threshold=0.64,
      )
  
      self.assertEqual(
          nested_simplify(outputs, decimals=4),
          [
              [
                  {
                      "score": 0.7235,
                      "label": "cat",
                      "box": {
                          "xmin": 204,
                          "ymin": 167,
                          "xmax": 232,
                          "ymax": 190,
                      },
                  },
                  {
                      "score": 0.6748,
                      "label": "remote",
                      "box": {
                          "xmin": 571,
                          "ymin": 83,
                          "xmax": 598,
                          "ymax": 103,
                      },
                  },
                  {
                      "score": 0.6456,
                      "label": "remote",
                      "box": {
                          "xmin": 494,
                          "ymin": 105,
                          "xmax": 521,
                          "ymax": 127,
                      },
                  },
                  {
                      "score": 0.642,
                      "label": "remote",
                      "box": {
                          "xmin": 67,
                          "ymin": 274,
                          "xmax": 93,
                          "ymax": 297,
                      },
                  },
              ],
              [
                  {
                      "score": 0.7235,
                      "label": "cat",
                      "box": {
                          "xmin": 204,
                          "ymin": 167,
                          "xmax": 232,
                          "ymax": 190,
                      },
                  },
                  {
                      "score": 0.6748,
                      "label": "remote",
                      "box": {
                          "xmin": 571,
                          "ymin": 83,
                          "xmax": 598,
                          "ymax": 103,
                      },
                  },
                  {
                      "score": 0.6456,
                      "label": "remote",
                      "box": {
                          "xmin": 494,
                          "ymin": 105,
                          "xmax": 521,
                          "ymax": 127,
                      },
                  },
                  {
                      "score": 0.642,
                      "label": "remote",
                      "box": {
                          "xmin": 67,
                          "ymin": 274,
                          "xmax": 93,
                          "ymax": 297,
                      },
                  },
              ],
          ],
      )
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/pipelines/test_pipelines_zero_shot_object_detection.py
imports: import unittest
  from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline
  from transformers.testing_utils import nested_simplify, require_tf, require_torch, require_vision, slow
  from .test_pipelines_common import ANY, PipelineTestCaseMeta
label_desc: Use image node_id 4 for calling the ZeroShotObjectDetectionPipelineTests obj's underlying member method code with example usage: obj.test_small_model_pt() without return types