code: def get_used_tokens_for_llm(
      model_inputs: torch.Tensor, tokenizer
  ) -> int:
      """Returns the number of used tokens for an LLM model.
  
      Args:
          model_inputs: torch.Tensor with the merged input and target IDs.
          tokenizer: The tokenizer used to encode the inputs.
  
      Returns:
          The total number of non-pad tokens, for all examples in the batch.
      """
      return torch.sum(model_inputs != tokenizer.pad_token_id).item()
  
imports: from typing import Dict, Union
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: get_used_tokens_for_llm(model_inputs, tokenizer) and returns: torch