code: def get_user_model_encoder(
      num_layers: int = _NUM_LAYERS,
      d_model: int = _MODEL_DIM,
      nhead: int = _NHEAD,
  ) -> Module:
      """Initialize the Transformer encoder."""
      encoder_layer = nn.TransformerEncoderLayer(
          d_model=d_model, nhead=nhead
      )
      return nn.TransformerEncoder(encoder_layer, num_layers=num_layers)
  
file_path: torchmetrics/examples/bert_score-own_model.py
imports: from pprint import pprint
  from typing import Dict, List, Union
  import torch
  from torch import Tensor, nn
  from torch.nn import Module
  from torchmetrics.text.bert import BERTScore
label_desc: Use image node_id 1 for calling a global function with example usage: get_user_model_encoder(num_layers, d_model, nhead) and returns: nn