code: def variant_compatible_siblings(
      filenames, variant=None
  ) -> Union[List[os.PathLike], str]:
      weight_names = [
          WEIGHTS_NAME,
          SAFETENSORS_WEIGHTS_NAME,
          FLAX_WEIGHTS_NAME,
          ONNX_WEIGHTS_NAME,
          ONNX_EXTERNAL_WEIGHTS_NAME,
      ]
  
      if is_transformers_available():
          weight_names += [
              TRANSFORMERS_WEIGHTS_NAME,
              TRANSFORMERS_SAFE_WEIGHTS_NAME,
              TRANSFORMERS_FLAX_WEIGHTS_NAME,
          ]
  
      # model_pytorch, diffusion_model_pytorch, ...
      weight_prefixes = [w.split(".")[0] for w in weight_names]
      # .bin, .safetensors, ...
      weight_suffixs = [w.split(".")[-1] for w in weight_names]
      # -00001-of-00002
      transformers_index_format = r"\d{5}-of-\d{5}"
  
      if variant is not None:
          # `diffusion_pytorch_model.fp16.bin` as well as `model.fp16-00001-of-00002.safetensors`
          variant_file_re = re.compile(
              rf"({'|'.join(weight_prefixes)})\.({variant}|{variant}-{transformers_index_format})\.({'|'.join(weight_suffixs)})$"
          )
          # `text_encoder/pytorch_model.bin.index.fp16.json`
          variant_index_re = re.compile(
              rf"({'|'.join(weight_prefixes)})\.({'|'.join(weight_suffixs)})\.index\.{variant}\.json$"
          )
  
      # `diffusion_pytorch_model.bin` as well as `model-00001-of-00002.safetensors`
      non_variant_file_re = re.compile(
          rf"({'|'.join(weight_prefixes)})(-{transformers_index_format})?\.({'|'.join(weight_suffixs)})$"
      )
      # `text_encoder/pytorch_model.bin.index.json`
      non_variant_index_re = re.compile(
          rf"({'|'.join(weight_prefixes)})\.({'|'.join(weight_suffixs)})\.index\.json"
      )
  
      if variant is not None:
          variant_weights = {
              f
              for f in filenames
              if variant_file_re.match(f.split("/")[-1]) is not None
          }
          variant_indexes = {
              f
              for f in filenames
              if variant_index_re.match(f.split("/")[-1]) is not None
          }
          variant_filenames = variant_weights | variant_indexes
      else:
          variant_filenames = set()
  
      non_variant_weights = {
          f
          for f in filenames
          if non_variant_file_re.match(f.split("/")[-1]) is not None
      }
      non_variant_indexes = {
          f
          for f in filenames
          if non_variant_index_re.match(f.split("/")[-1]) is not None
      }
      non_variant_filenames = non_variant_weights | non_variant_indexes
  
      # all variant filenames will be used by default
      usable_filenames = set(variant_filenames)
  
      def convert_to_variant(filename):
          if "index" in filename:
              variant_filename = filename.replace(
                  "index", f"index.{variant}"
              )
          elif (
              re.compile(f"^(.*?){transformers_index_format}").match(
                  filename
              )
              is not None
          ):
              variant_filename = f"{filename.split('-')[0]}.{variant}-{'-'.join(filename.split('-')[1:])}"
          else:
              variant_filename = f"{filename.split('.')[0]}.{variant}.{filename.split('.')[1]}"
          return variant_filename
  
      for f in non_variant_filenames:
          variant_filename = convert_to_variant(f)
          if variant_filename not in usable_filenames:
              usable_filenames.add(f)
  
      return usable_filenames, variant_filenames
  
imports: import fnmatch
  import importlib
  import inspect
  import os
  import re
  import sys
  import warnings
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from huggingface_hub import ModelCard, create_repo, hf_hub_download, model_info, snapshot_download
  from packaging import version
  from requests.exceptions import HTTPError
  from tqdm.auto import tqdm
  import diffusers
  from ..None import __version__
  from ..configuration_utils import ConfigMixin
  from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT
  from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME
  from ..utils import CONFIG_NAME, DEPRECATED_REVISION_ARGS, DIFFUSERS_CACHE, HF_HUB_OFFLINE, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME, BaseOutput, deprecate, get_class_from_dynamic_module, is_accelerate_available, is_accelerate_version, is_torch_version, is_transformers_available, logging, numpy_to_pil
  from ..utils.torch_utils import is_compiled_module
  from ..utils import FLAX_WEIGHTS_NAME, ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, PushToHubMixin
label_desc: Use image node_id 2 for calling a global function with example usage: variant_compatible_siblings(filenames, variant) and returns: usable_filenames,  variant_filenames, variant_filename