code: def __init__(self, config, dataset):
      super(BERT4Rec, self).__init__(config, dataset)
  
      # load parameters info
      self.n_layers = config["n_layers"]
      self.n_heads = config["n_heads"]
      self.hidden_size = config["hidden_size"]  # same as embedding_size
      self.inner_size = config[
          "inner_size"
      ]  # the dimensionality in feed-forward layer
      self.hidden_dropout_prob = config["hidden_dropout_prob"]
      self.attn_dropout_prob = config["attn_dropout_prob"]
      self.hidden_act = config["hidden_act"]
      self.layer_norm_eps = config["layer_norm_eps"]
  
      self.mask_ratio = config["mask_ratio"]
  
      self.MASK_ITEM_SEQ = config["MASK_ITEM_SEQ"]
      self.POS_ITEMS = config["POS_ITEMS"]
      self.NEG_ITEMS = config["NEG_ITEMS"]
      self.MASK_INDEX = config["MASK_INDEX"]
  
      self.loss_type = config["loss_type"]
      self.initializer_range = config["initializer_range"]
  
      # load dataset info
      self.mask_token = self.n_items
      self.mask_item_length = int(self.mask_ratio * self.max_seq_length)
  
      # define layers and loss
      self.item_embedding = nn.Embedding(
          self.n_items + 1, self.hidden_size, padding_idx=0
      )  # mask token add 1
      self.position_embedding = nn.Embedding(
          self.max_seq_length, self.hidden_size
      )  # add mask_token at the last
      self.trm_encoder = TransformerEncoder(
          n_layers=self.n_layers,
          n_heads=self.n_heads,
          hidden_size=self.hidden_size,
          inner_size=self.inner_size,
          hidden_dropout_prob=self.hidden_dropout_prob,
          attn_dropout_prob=self.attn_dropout_prob,
          hidden_act=self.hidden_act,
          layer_norm_eps=self.layer_norm_eps,
      )
  
      self.LayerNorm = nn.LayerNorm(
          self.hidden_size, eps=self.layer_norm_eps
      )
      self.dropout = nn.Dropout(self.hidden_dropout_prob)
      self.output_ffn = nn.Linear(self.hidden_size, self.hidden_size)
      self.output_gelu = nn.GELU()
      self.output_ln = nn.LayerNorm(
          self.hidden_size, eps=self.layer_norm_eps
      )
      self.output_bias = nn.Parameter(torch.zeros(self.n_items))
  
      # we only need compute the loss at the masked position
      try:
          assert self.loss_type in ["BPR", "CE"]
      except AssertionError:
          raise AssertionError(
              "Make sure 'loss_type' in ['BPR', 'CE']!"
          )
  
      # parameters initialization
      self.apply(self._init_weights)
  
file_path: RecBole/recbole/model/sequential_recommender/bert4rec.py
imports: import random
  import torch
  from torch import nn
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.layers import TransformerEncoder
label_desc: Use image node_id 1 to create a new BERT4Rec object from inherited base classes: SequentialRecommender with example: obj = BERT4Rec(config, dataset)