code: def update(
      self, tokens: Tensor, logits: Tensor, sum_logprobs: Tensor
  ) -> Tuple[Tensor, bool]:
      if self.temperature == 0:
          next_tokens = logits.argmax(dim=-1)
      else:
          next_tokens = Categorical(
              logits=logits / self.temperature
          ).sample()
  
      logprobs = F.log_softmax(logits.float(), dim=-1)
      current_logprobs = logprobs[
          torch.arange(logprobs.shape[0]), next_tokens
      ]
      sum_logprobs += current_logprobs * (tokens[:, -1] != self.eot)
  
      next_tokens[tokens[:, -1] == self.eot] = self.eot
      tokens = torch.cat([tokens, next_tokens[:, None]], dim=-1)
  
      completed = (tokens[:, -1] == self.eot).all()
      return tokens, completed
  
imports: from dataclasses import dataclass, field, replace
  from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.distributions import Categorical
  from .audio import CHUNK_LENGTH
  from .tokenizer import Tokenizer, get_tokenizer
  from .utils import compression_ratio
label_desc: Use image node_id 2 for calling the GreedyDecoder obj's underlying member method code with example usage: obj.update(tokens, logits, sum_logprobs) and returns: tokens,  completed