code: def from_pb(
      cls,
      pb: List[generate_pb2.NextTokenChooserParameters],
      dtype: torch.dtype,
      device: torch.device,
  ) -> "HeterogeneousNextTokenChooser":
      return HeterogeneousNextTokenChooser(
          watermark=[pb_.watermark for pb_ in pb],
          temperature=[pb_.temperature for pb_ in pb],
          repetition_penalty=[pb_.repetition_penalty for pb_ in pb],
          top_k=[pb_.top_k for pb_ in pb],
          top_p=[pb_.top_p for pb_ in pb],
          typical_p=[pb_.typical_p for pb_ in pb],
          do_sample=[pb_.do_sample for pb_ in pb],
          seeds=[pb_.seed for pb_ in pb],
          device=device,
          dtype=dtype,
      )
  
imports: import re
  from typing import Callable, List, Optional, Tuple
  import torch
  from text_generation_server.pb import generate_pb2
  from text_generation_server.pb.generate_pb2 import FinishReason
  from text_generation_server.utils.logits_process import HeterogeneousProcessorWrapper, HeterogeneousRepetitionPenaltyLogitsProcessor, HeterogeneousTemperatureLogitsWarper, HeterogeneousTopKLogitsWarper, HeterogeneousTopPLogitsWarper, HeterogeneousTypicalLogitsWarper, static_warper
  from text_generation_server.utils.watermark import WatermarkLogitsProcessor
  from transformers import PreTrainedTokenizerBase, RepetitionPenaltyLogitsProcessor
label_desc: Use image node_id 4 for calling the HeterogeneousNextTokenChooser obj's underlying member method code with example usage: obj.from_pb(cls, pb, dtype, device) and returns: HeterogeneousNextTokenChooser