class_docstr: Test ModelToTriton
class_docstr_tok: ["Test","ModelToTriton"]
code: def test_prepare(self):
      name = "resnet18_conf1"
      server_config = {"format_priority": ["onnx", "tensorrt"]}
      node_config = NodeConfig(
          name=name,
          server={
              "device_ids": [0, 1],
              "max_batch_size": 128,
              "batch_latency_micros": 100000,
              "no_key": 0,
              "triton": {
                  "preferred_batch_size": [8, 16],
              },
          },
      )
      with TemporaryDirectory(dir="./") as root:
          m = ModelToTriton(root, op, name, node_config, server_config)
          self.assertEqual(m.to_triton(), 1)
  
          model_path = Path(root) / name
          path1 = model_path / "config.pbtxt"
          with open(path1, encoding="utf-8") as f:
              file_config = list(f.readlines())
          pbtxt_config = [
              'name: "resnet18_conf1"\n',
              'backend: "onnxruntime"\n',
              "max_batch_size: 128\n",
              "\n",
              "dynamic_batching {\n",
              "\n",
              "    preferred_batch_size: [8, 16]\n",
              "\n",
              "    max_queue_delay_microseconds: 100000\n",
              "\n",
              "}\n",
              "\n",
              "instance_group [\n",
              "    {\n",
              "        kind: KIND_GPU\n",
              "        count: 1\n",
              "        gpus: [0, 1]\n",
              "    }\n",
              "]\n",
          ]
          self.assertEqual(file_config, pbtxt_config)
          path2 = model_path / "1" / "model.onnx"
          self.assertTrue(path2.exists())
  
file_path: towhee/tests/unittests/serve/triton/test_model_to_triton.py
imports: import unittest
  from pathlib import Path
  from tempfile import TemporaryDirectory
  import torch
  import torchvision
  from towhee.runtime.node_config import NodeConfig
  from towhee.serve.triton.model_to_triton import ModelToTriton
label_desc: Use image node_id 2 for calling the TestModelToTriton obj's underlying member method code with example usage: obj.test_prepare() without return types