code: def _parseq(
      arch: str,
      pretrained: bool,
      backbone_fn,
      input_shape: Optional[Tuple[int, int, int]] = None,
      **kwargs: Any,
  ) -> PARSeq:
      # Patch the config
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["input_shape"] = input_shape or _cfg["input_shape"]
      _cfg["vocab"] = kwargs.get("vocab", _cfg["vocab"])
      patch_size = kwargs.get("patch_size", (4, 8))
  
      kwargs["vocab"] = _cfg["vocab"]
  
      # Feature extractor
      feat_extractor = backbone_fn(
          # NOTE: we don't use a pretrained backbone for non-rectangular patches to avoid the pos embed mismatch
          pretrained=False,
          input_shape=_cfg["input_shape"],
          patch_size=patch_size,
          include_top=False,
      )
  
      kwargs.pop("patch_size", None)
      kwargs.pop("pretrained_backbone", None)
  
      # Build the model
      model = PARSeq(feat_extractor, cfg=_cfg, **kwargs)
      # Load pretrained parameters
      if pretrained:
          load_pretrained_params(model, default_cfgs[arch]["url"])
  
      return model
  
imports: import math
  from copy import deepcopy
  from itertools import permutations
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  import tensorflow
  from tensorflow.keras import Model, layers
  from doctr.datasets import VOCABS
  from doctr.models.modules.transformer import MultiHeadAttention, PositionwiseFeedForward
  from ...classification import vit_s
  from ...utils.tensorflow import _bf16_to_float32, load_pretrained_params
  from .base import _PARSeq, _PARSeqPostProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: _parseq(arch, pretrained, backbone_fn, input_shape) and returns: model