code: def test_torch_huggingface_torchscript_input_tensors():
      tokenizer = AlbertTokenizer.from_pretrained("albert-base-v1")
      model = AlbertModel.from_pretrained(
          "albert-base-v1", torchscript=True
      )
  
      # Move the model to gpu if available
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      model.to(device)
      model.eval()
  
      text = "hi my name is Valerio"
      inputs = tokenizer(text, return_tensors="pt").to(device)
  
      dynamic_info = {
          "inputs": [
              {0: "batch", 1: "num_tokens"},
              {0: "batch", 1: "num_tokens"},
              {0: "batch", 1: "num_tokens"},
          ],
          "outputs": [{0: "batch", 1: "num_tokens"}, {0: "batch"}],
      }
  
      optimized_model = optimize_model(
          model=model,
          input_data=[inputs for _ in range(10)],
          optimization_time="constrained",
          ignore_compilers=[
              compiler
              for compiler in COMPILER_LIST
              if compiler != "torchscript"
          ],
          ignore_compressors=[
              compressor for compressor in COMPRESSOR_LIST
          ],
          dynamic_info=dynamic_info,
      )
  
      x = ["this is a test input to see if the optimized model works."]
      inputs = tokenizer(x, return_tensors="pt").to(device)
      model.to(device)
      res_original = model(**inputs)
      res_optimized = optimized_model(**inputs)
  
      assert isinstance(optimized_model, HuggingFaceInferenceLearner)
  
      assert (
          torch.mean(abs((res_original[0] - res_optimized[0]))) < 1e-2
      )
      assert (
          torch.mean(abs((res_original[1] - res_optimized[1]))) < 1e-2
      )
  
file_path: nebuly/optimization/speedster/speedster/api/tests/test_huggingface.py
imports: from tempfile import TemporaryDirectory
  from nebullvm.config import COMPILER_LIST, COMPRESSOR_LIST
  from nebullvm.operations.inference_learners.huggingface import HuggingFaceInferenceLearner
  from nebullvm.optional_modules.tensorflow import tensorflow
  from nebullvm.optional_modules.torch import torch
  from transformers import AlbertModel, TFAlbertModel, AlbertTokenizer
  from speedster import optimize_model, load_model
label_desc: Use image node_id 3 for calling a global function with example usage: test_torch_huggingface_torchscript_input_tensors() without return types