code: def basic_blocks(
      opts: argparse.Namespace,
      dim: int,
      block_index: int,
      num_blocks: List[int],
      token_mixer_type: str,
      kernel_size: int = 3,
      mlp_ratio: float = 4.0,
      drop_rate: float = 0.0,
      drop_path_rate: float = 0.0,
      inference_mode: bool = False,
      use_layer_scale: bool = True,
      layer_scale_init_value: float = 1e-5,
  ) -> nn.Sequential:
      """Build FastViT blocks within a stage.
  
      Args:
          opts: Command line arguments.
          dim: Number of embedding dimensions.
          block_index: block index.
          num_blocks: List containing number of blocks per stage.
          token_mixer_type: Token mixer type.
          kernel_size: Kernel size for repmixer.
          mlp_ratio: MLP expansion ratio.
          drop_rate: Dropout rate.
          drop_path_rate: Drop path rate.
          inference_mode: Flag to instantiate block in inference mode.
          use_layer_scale: Flag to turn on layer scale regularization.
          layer_scale_init_value: Layer scale value at initialization.
  
      Returns:
          nn.Sequential object of all the blocks within the stage.
      """
      blocks = []
      for block_idx in range(num_blocks[block_index]):
          block_dpr = (
              drop_path_rate
              * (block_idx + sum(num_blocks[:block_index]))
              / (sum(num_blocks) - 1)
          )
          if token_mixer_type == "repmixer":
              blocks.append(
                  RepMixerBlock(
                      opts,
                      dim,
                      kernel_size=kernel_size,
                      mlp_ratio=mlp_ratio,
                      drop=drop_rate,
                      drop_path=block_dpr,
                      inference_mode=inference_mode,
                      use_layer_scale=use_layer_scale,
                      layer_scale_init_value=layer_scale_init_value,
                  )
              )
          elif token_mixer_type == "attention":
              blocks.append(
                  AttentionBlock(
                      opts,
                      dim,
                      mlp_ratio=mlp_ratio,
                      drop=drop_rate,
                      drop_path=block_dpr,
                      use_layer_scale=use_layer_scale,
                      layer_scale_init_value=layer_scale_init_value,
                  )
              )
          else:
              raise ValueError(
                  "Token mixer type: {} not supported".format(
                      token_mixer_type
                  )
              )
  
      blocks = nn.Sequential(*blocks)
      return blocks
  
file_path: ml-cvnets/cvnets/models/classification/fastvit.py
imports: import argparse
  import copy
  from typing import List
  import torch.nn
  from cvnets.layers import GlobalPool, Identity, LinearLayer
  from cvnets.models import MODEL_REGISTRY
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.classification.config.fastvit import get_configuration
  from cvnets.modules.fastvit import AttentionBlock, PatchEmbed, RepMixerBlock, convolutional_stem
  from cvnets.modules.mobileone_block import MobileOneBlock
  from utils import logger
label_desc: Use image node_id 1 for calling a global function with example usage: basic_blocks(opts, dim, block_index, num_blocks, token_mixer_type, kernel_size, mlp_ratio, drop_rate, drop_path_rate, inference_mode, use_layer_scale, layer_scale_init_value) and returns: blocks