code: def test_huggingface_bert_model_parallel_inference():
      number_of_gpus = torch.cuda.device_count()
      check = os.popen(f"curl http://localhost:8081/models")
      print(check)
      if number_of_gpus > 1:
          batch_size = 1
          batch_delay = 5000  # 10 seconds
          params = (
              ("model_name", "Textgeneration"),
              (
                  "url",
                  "https://bert-mar-file.s3.us-west-2.amazonaws.com/Textgeneration.mar",
              ),
              ("initial_workers", "1"),
              ("batch_size", str(batch_size)),
              ("max_batch_delay", str(batch_delay)),
          )
          test_utils.start_torchserve(no_config_snapshots=True)
          test_utils.register_model_with_params(params)
          input_text = os.path.join(
              REPO_ROOT,
              "examples",
              "Huggingface_Transformers",
              "Text_gen_artifacts",
              "sample_text_captum_input.txt",
          )
  
          response = os.popen(
              f"curl http://127.0.0.1:8080/predictions/Textgeneration -T {input_text}"
          )
          response = response.read()
  
          assert (
              "Bloomberg has decided to publish a new report on the global economy"
              in response
          )
          test_utils.unregister_model("Textgeneration")
      else:
          logger.info(
              "Running model parallel inference requuires more than one gpu, number of available gpus on thi machine is: ",
              number_of_gpus,
          )
  
imports: import ast
  import json
  import logging
  import os
  import numpy
  import pytest
  import requests
  import test_utils
  import torch
label_desc: Use image node_id 18 for calling a global function with example usage: test_huggingface_bert_model_parallel_inference() without return types