code: def split_encoder_non_encoder(
      names: List[str], post_encoder_patterns: Tuple[str, ...]
  ):
      """
      Group layer names into two types: encoder and non-encoder.
      A layer belongs to encoder if its name contains at least one digit.
      It uses this rule since a model's encoder in Pytorch's implementation
      is generally wrapped by nn.Sequential() or nn.ModuleList(),
      which produce digits in layer names.
  
      Parameters
      ----------
      names
          Model layer names.
      Returns
      -------
      encoder_names
          A list of encoder layer names.
      non_encoder_names
          A list of non-encoder layer names.
      """
      encoder_names = []
      non_encoder_names = []
      for n in names:
          is_encoder = False
          if any(p in n for p in post_encoder_patterns):
              non_encoder_names.append(n)
              continue
          for i in n.split("."):
              if i.isdigit():
                  encoder_names.append(n)
                  is_encoder = True
                  break
          if not is_encoder:
              non_encoder_names.append(n)
  
      return encoder_names, non_encoder_names
  
imports: import logging
  import re
  import warnings
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch._dynamo
  import torch.nn.functional
  from torch import nn
  from torch.nn.modules.loss import _Loss
  from transformers import AutoConfig, AutoModel, AutoTokenizer, BertTokenizer, CLIPTokenizer, ElectraTokenizer
  from transformers.models.mask2former.modeling_mask2former import Mask2FormerLoss
  from ..constants import AUTOMM, CLASS_LOGITS, COLUMN_FEATURES, FEATURES, LOGITS, MASKS, OCR, PEFT_ADDITIVE_STRATEGIES, REGRESSION, SEMANTIC_MASK, SEMANTIC_SEGMENTATION
  from .adaptation_layers import IA3Linear, IA3LoRALinear, LoRALinear
label_desc: Use image node_id 4 for calling a global function with example usage: split_encoder_non_encoder(names, post_encoder_patterns) and returns: encoder_names,  non_encoder_names