code: def __init__(self, config: MgpstrConfig):
      super().__init__()
      # stochastic depth decay rule
      dpr = [
          x.item()
          for x in torch.linspace(
              0, config.drop_path_rate, config.num_hidden_layers
          )
      ]
  
      self.blocks = nn.Sequential(
          *[
              MgpstrLayer(config=config, drop_path=dpr[i])
              for i in range(config.num_hidden_layers)
          ]
      )
  
imports: import collections.abc
  from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn.functional
  import torch.utils.checkpoint
  from torch import nn
  from ...modeling_outputs import BaseModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_mgp_str import MgpstrConfig
label_desc: Use image node_id 1 to create a new MgpstrEncoder object from inherited base classes: nn with example: obj = MgpstrEncoder(config)