code: def sharded_paths(
      path: str, module_names: List[str]
  ) -> Dict[str, str]:
      model_name = "model.safetensors"
      if not os.path.exists(
          str(Path(path) / model_name)
      ) and not os.path.exists(
          str(Path(path) / f"{model_name}.index.json")
      ):
          model_name = "pytorch_model.bin"
  
      index_path = str(Path(path) / f"{model_name}.index.json")
      if os.path.exists(index_path):
          with open(index_path, "r", encoding="utf-8") as file:
              data = json.load(file)
          return data["weight_map"]
      return {
          (module_name + ".weight"): model_name
          for module_name in module_names
      }
  
imports: from typing import Optional
  import torch
  from transformers.trainer import Trainer
  import glob
  import json
  import logging
  import os.path
  import shutil
  from pathlib import Path
  from typing import Dict, List, Sequence
  import peft
  import safetensors.torch
  import torch
  from huggingface_hub import snapshot_download
  from torch.optim.lr_scheduler import LRScheduler
  from torch.optim.optimizer import Optimizer
  from transformers import TrainerCallback, TrainerControl, TrainerState, TrainingArguments
  from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR
  import torch.distributed
  from bigdl.llm.transformers.qlora import LoraLowBitLinear
  from bigdl.llm.transformers.low_bit_linear import FP4Params
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 4 for calling a global function with example usage: sharded_paths(path, module_names) and returns: unknown, data