code: def preprocess_code(
      code: Union[str, list, torch.Tensor],
      deduplicate_code: bool = False,
  ) -> torch.Tensor:
      """
      Convert the code to a long tensor.
      The code can be one of the following forms:
          - String of integers: "1 2 3"
          - List/Array of (string of) integers: [1, 2, 3]
      """
      if isinstance(code, str):
          code = code.split()
      if isinstance(code, list):
          code = list(map(int, code))
          code = torch.tensor(code)
      elif isinstance(code, np.ndarray):
          code = torch.from_numpy(code)
      code = code.long()
      if deduplicate_code:
          code = torch.unique_consecutive(code)
      return code.view(1, -1)
  
file_path: textlesslib/textless/vocoders/hifigan/vocoder.py
imports: import torch
  import torch.nn
  import numpy
  from .generator import CodeGenerator
  import json
  from typing import Union
  from pathlib import Path
  from textless.checkpoint_manager import CHECKPOINT_MANAGER
label_desc: Use image node_id 2 for calling a global function with example usage: preprocess_code(code, deduplicate_code) and returns: code