code: def from_pb(
      cls,
      pb: generate_pb2.NextTokenChooserParameters,
      device: torch.device,
  ) -> "NextTokenChooser":
      return NextTokenChooser(
          watermark=pb.watermark,
          temperature=pb.temperature,
          repetition_penalty=pb.repetition_penalty,
          top_k=pb.top_k,
          top_p=pb.top_p,
          typical_p=pb.typical_p,
          do_sample=pb.do_sample,
          seed=pb.seed,
          device=device,
      )
  
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 3 for calling the NextTokenChooser obj's underlying member method code with example usage: obj.from_pb(cls, pb, device) and returns: NextTokenChooser