code: def _prepare_lora_args(
      raw_arg: LoraOptionType, lora_dir: str | None = None
  ) -> tuple[str, dict[str, str]]:
      if lora_dir is None:
          lora_dir = os.getcwd()
  
      lora_dir = os.path.expanduser(lora_dir)
  
      # if user only provide a string, we try to use the string as a
      # path (either absolute or relative) to the weight file. If no
      # file detected, treat the string as huggingface repository
      # identifier
      if isinstance(raw_arg, str):
          raw_arg = raw_arg.strip()
          arg_path = os.path.expanduser(raw_arg)
          weight_path = None
  
          # absolute path case
          if os.path.isabs(arg_path) and os.path.exists(arg_path):
              weight_path = arg_path
  
          # relative path case
          tmp_path = os.path.join(lora_dir, arg_path)
          if os.path.exists(tmp_path):
              weight_path = tmp_path
  
          if weight_path:
              model_name = os.path.dirname(weight_path)
              weight_name = os.path.basename(weight_path)
              kwargs = {"weight_name": weight_name}
              return (model_name, kwargs)
  
          # repo id case
          lst = raw_arg.split("/")
          if not len(lst) > 2:
              raise ValueError(
                  f"{raw_arg} is not a valid huggingface LoRA path"
              )
          model_name = "/".join(lst[:2])
          weight_name = "/".join(lst[2:])
          kwargs = {"weight_name": weight_name}
          return (model_name, kwargs)
  
      model_name = raw_arg.pop("model_name")
      return (model_name, raw_arg)
  
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import typing
  from typing import TYPE_CHECKING
  import attr
  import bentoml
  from bentoml import Tag
  from bentoml.exceptions import BentoMLException
  from bentoml.exceptions import MissingDependencyException
  from bentoml.exceptions import NotFound
  from bentoml.models import ModelContext
  from ..models.model import PartialKwargsModelOptions
  from .utils.transformers import extract_commit_hash
label_desc: Use image node_id 1 for calling a global function with example usage: _prepare_lora_args(raw_arg, lora_dir) and returns: model_name,  raw_arg, model_name,  kwargs, model_name,  kwargs