code: def _tokenize_fn(
      strings: Sequence[str],
      tokenizer: AutoTokenizer,
      max_length: int = 512,
  ) -> Dict:
      """Tokenize a list of strings."""
      tokenized_list = [
          tokenizer(
              text,
              return_tensors="pt",
              padding="longest",
              max_length=max_length,
              truncation=True,
          )
          for text in strings
      ]
      input_ids = labels = [
          tokenized.input_ids[0] for tokenized in tokenized_list
      ]
      input_ids_lens = labels_lens = [
          tokenized.input_ids.ne(tokenizer.pad_token_id).sum().item()
          for tokenized in tokenized_list
      ]
      return dict(
          input_ids=input_ids,
          labels=labels,
          input_ids_lens=input_ids_lens,
          labels_lens=labels_lens,
      )
  
imports: import copy
  import json
  from typing import Dict, Sequence
  import torch
  from torch.utils.data import Dataset
  from tqdm import tqdm
  from transformers import AutoTokenizer
label_desc: Use image node_id 1 for calling a global function with example usage: _tokenize_fn(strings, tokenizer, max_length) and returns: dict