class_docstr: Greedy sequence generator based on the decoder followed by log_softmax.
  
  Args:
      embedding: nn.Module, transforms input_ids into vector embeddings
      decoder: nn.Module, takes embeddings and produces hidden_states
      log_softmax: nn.Module, takes hidden_states and produces log_probs
          which correspond to probability distribution of tokens (ids)
      pad: index of padding token in the vocabulary
      bos: index of beginning of sequence token in the vocabulary
      eos: index of end of sequence token in the vocabulary
      max_sequence_length: maximum allowed length for generated sequences
      max_delta_length: in case of encoder-decoder generation (e.g. NMT),
          forbids generated sequences to be longer than the length of
          source sequences plus max_delta_length
      batch_size: size of the batch of generated sequences if neither
          source nor target starting sequences are provided
class_docstr_tok: ["Greedy","sequence","generator","based","on","the","decoder","followed","by","log_softmax",".","Args",":","embedding",":","nn.Module",",","transforms","input_ids","into","vector","embeddings","decoder",":","nn.Module",",","takes","embeddings","and","produces","hidden_states","log_softmax",":","nn.Module",",","takes","hidden_states","and","produces","log_probs","which","correspond","to","probability","distribution","of","tokens","(","ids",")","pad",":","index","of","padding","token","in","the","vocabulary","bos",":","index","of","beginning","of","sequence","token","in","the","vocabulary","eos",":","index","of","end","of","sequence","token","in","the","vocabulary","max_sequence_length",":","maximum","allowed","length","for","generated","sequences","max_delta_length",":","in","case","of","encoder-decoder","generation","(","e.g",".","NMT",")",",","forbids","generated","sequences","to","be","longer","than","the","length","of","source","sequences","plus","max_delta_length","batch_size",":","size","of","the","batch","of","generated","sequences","if","neither","source","nor","target","starting","sequences","are","provided"]
docstr: Freeze weights of embedding, decoder, and classification layers to prevent memory leak.
          
docstr_tok: ["Freeze","weights","of","embedding",",","decoder",",","and","classification","layers","to","prevent","memory","leak","."]
code: def freeze(self) -> None:
      """Freeze weights of embedding, decoder, and classification layers to prevent memory leak."""
      for param in self.embedding.parameters():
          param.requires_grad = False
      self.embedding.eval()
      for param in self.decoder.parameters():
          param.requires_grad = False
      self.decoder.eval()
      for param in self.log_softmax.parameters():
          param.requires_grad = False
      self.log_softmax.eval()
  
imports: from contextlib import contextmanager
  import torch
  from nemo.collections.common.parts import NEG_INF, mask_padded_tokens
label_desc: Use image node_id 6 for calling the GreedySequenceGenerator obj's underlying member method code with example usage: obj.freeze() without return types