class_docstr: Electra Model
  
  This is almost the same as bert model with embedding_size adjustable (factorized embedding).
class_docstr_tok: ["Electra","Model","This","is","almost","the","same","as","bert","model","with","embedding_size","adjustable","(","factorized","embedding",")","."]
docstr: Froze part of parameters according to layer depth.
  
  That is, make all layer that shallower than `untunable_depth` untunable
  to stop the gradient backward computation and accelerate the training.
  
  Parameters
  ----------
  untunable_depth
      the depth of the neural network starting from 1 to number of layers
  not_included
      A list or parameter names that not included in the untunable parameters
docstr_tok: ["Froze","part","of","parameters","according","to","layer","depth",".","That","is",",","make","all","layer","that","shallower","than","`","untunable_depth","`","untunable","to","stop","the","gradient","backward","computation","and","accelerate","the","training",".","Parameters","--","--","--","--","--","untunable_depth","the","depth","of","the","neural","network","starting","from","1","to","number","of","layers","not_included","A","list","or","parameter","names","that","not","included","in","the","untunable","parameters"]
code: def frozen_params(
      self,
      untunable_depth: int,
      not_included: Optional[List[str]] = None,
  ):
      """Froze part of parameters according to layer depth.
  
      That is, make all layer that shallower than `untunable_depth` untunable
      to stop the gradient backward computation and accelerate the training.
  
      Parameters
      ----------
      untunable_depth
          the depth of the neural network starting from 1 to number of layers
      not_included
          A list or parameter names that not included in the untunable parameters
      """
      all_layers = self.encoder.all_encoder_layers
      for _, value in self.collect_params(".*embed*").items():
          value.grad_req = "null"
  
      for layer in all_layers[:untunable_depth]:
          for key, value in layer.collect_params().items():
              if not_included:
                  for pn in not_included:
                      if pn in key:
                          continue
              value.grad_req = "null"
  
imports: import os
  from typing import Tuple, Optional, List
  import mxnet
  from mxnet import use_np, np, npx
  from mxnet.gluon import HybridBlock, nn
  from .base import BACKBONE_REGISTRY
  from .transformer import TransformerEncoderLayer
  from ..op import gumbel_softmax, select_vectors_by_position, add_vectors_by_position, update_vectors_by_position
  from ..base import get_model_zoo_home_dir, get_repo_model_zoo_url, get_model_zoo_checksum_dir
  from ..layers import PositionalEmbedding, get_activation
  from ..initializer import TruncNorm
  from ..utils.config import CfgNode
  from ..utils.misc import load_checksum_stats, download
  from ..utils.registry import Registry
  from ..attention_cell import gen_self_attn_mask
  from ..data.tokenizers import HuggingFaceWordPieceTokenizer
label_desc: Use image node_id 6 for calling the ElectraModel obj's underlying member method code with example usage: obj.frozen_params(untunable_depth, not_included) without return types