docstr: Validate parameters before uploading trained model artifacts.
  
  This method checks if the input parameters meet the necessary requirements before uploading
  trained model artifacts to the target repository.
  
  Args:
      repo_id (str): The ID of the target repository. It must be a namespace (user or an organization)
          and a repository name separated by a '/'. For example, if your HF username is 'johndoe' and you
          want to create a repository called 'test', the repo_id should be 'johndoe/test'.
      model_path (str): The path to the directory containing the trained model artifacts. It should contain
          the model's weights, usually saved under 'model/model_weights'.
      repo_type (str, optional): The type of the repository. Not used in the base class, but subclasses
          may use it for specific repository implementations. Defaults to None.
      private (bool, optional): Whether the repository should be private or not. Not used in the base class,
          but subclasses may use it for specific repository implementations. Defaults to False.
      commit_message (str, optional): A message to attach to the commit when uploading to version control
          systems. Not used in the base class, but subclasses may use it for specific repository
          implementations. Defaults to None.
      commit_description (str, optional): A description of the commit when uploading to version control
          systems. Not used in the base class, but subclasses may use it for specific repository
          implementations. Defaults to None.
  
  Raises:
      ValueError: If the repo_id does not have both a namespace and a repo name separated by a '/'.
docstr_tok: ["Validate","parameters","before","uploading","trained","model","artifacts",".","This","method","checks","if","the","input","parameters","meet","the","necessary","requirements","before","uploading","trained","model","artifacts","to","the","target","repository",".","Args",":","repo_id","(","str",")",":","The","ID","of","the","target","repository",".","It","must","be","a","namespace","(","user","or","an","organization",")","and","a","repository","name","separated","by","a","'\/","'",".","For","example",",","if","your","HF","username","is","'johndoe","'","and","you","want","to","create","a","repository","called","'test","'",",","the","repo_id","should","be","'johndoe\/test","'",".","model_path","(","str",")",":","The","path","to","the","directory","containing","the","trained","model","artifacts",".","It","should","contain","the","model","'s","weights",",","usually","saved","under","'model\/model_weights","'",".","repo_type","(","str",",","optional",")",":","The","type","of","the","repository",".","Not","used","in","the","base","class",",","but","subclasses","may","use","it","for","specific","repository","implementations",".","Defaults","to","None",".","private","(","bool",",","optional",")",":","Whether","the","repository","should","be","private","or","not",".","Not","used","in","the","base","class",",","but","subclasses","may","use","it","for","specific","repository","implementations",".","Defaults","to","False",".","commit_message","(","str",",","optional",")",":","A","message","to","attach","to","the","commit","when","uploading","to","version","control","systems",".","Not","used","in","the","base","class",",","but","subclasses","may","use","it","for","specific","repository","implementations",".","Defaults","to","None",".","commit_description","(","str",",","optional",")",":","A","description","of","the","commit","when","uploading","to","version","control","systems",".","Not","used","in","the","base","class",",","but","subclasses","may","use","it","for","specific","repository","implementations",".","Defaults","to","None",".","Raises",":","ValueError",":","If","the","repo_id","does","not","have","both","a","namespace","and","a","repo","name","separated","by","a","'\/","'","."]
code: def _validate_upload_parameters(
      repo_id: str,
      model_path: str,
      repo_type: str | None = None,
      private: bool | None = False,
      commit_message: str | None = None,
      commit_description: str | None = None,
  ):
      """Validate parameters before uploading trained model artifacts.
  
      This method checks if the input parameters meet the necessary requirements before uploading
      trained model artifacts to the target repository.
  
      Args:
          repo_id (str): The ID of the target repository. It must be a namespace (user or an organization)
              and a repository name separated by a '/'. For example, if your HF username is 'johndoe' and you
              want to create a repository called 'test', the repo_id should be 'johndoe/test'.
          model_path (str): The path to the directory containing the trained model artifacts. It should contain
              the model's weights, usually saved under 'model/model_weights'.
          repo_type (str, optional): The type of the repository. Not used in the base class, but subclasses
              may use it for specific repository implementations. Defaults to None.
          private (bool, optional): Whether the repository should be private or not. Not used in the base class,
              but subclasses may use it for specific repository implementations. Defaults to False.
          commit_message (str, optional): A message to attach to the commit when uploading to version control
              systems. Not used in the base class, but subclasses may use it for specific repository
              implementations. Defaults to None.
          commit_description (str, optional): A description of the commit when uploading to version control
              systems. Not used in the base class, but subclasses may use it for specific repository
              implementations. Defaults to None.
  
      Raises:
          ValueError: If the repo_id does not have both a namespace and a repo name separated by a '/'.
      """
      # Validate repo_id has both a namespace and a repo name
      if "/" not in repo_id:
          raise ValueError(
              "`repo_id` must be a namespace (user or an organization) and a repo name separated by a `/`."
              " For example, if your HF username is `johndoe` and you want to create a repository called `test`, the"
              " repo_id should be johndoe/test"
          )
      BaseModelUpload._validate_upload_parameters(
          repo_id,
          model_path,
          repo_type,
          private,
          commit_message,
          commit_description,
      )
  
      trained_model_artifacts_path = os.path.join(
          model_path, "model", "model_weights"
      )
      """
          Make sure the model's saved artifacts either contain:
          1. pytorch_model.bin -> regular model training, such as ECD or for LLMs
          2. adapter_model.bin or adapter_model.safetensors -> LLM fine-tuning using PEFT
             <Alex(12/10/2023): TODO>
                  As of PEFT version "0.7.0", "adapter_model" storage format was changed from ".bin" to ".safetensors".
                  For backward compatibility, both formats will be supported, until depracating ".bin" format formally.
             </Alex(12/10/2023): TODO>
          """
      files = set(os.listdir(trained_model_artifacts_path))
      acceptable_model_artifact_file_nanes: set[str] = {
          "pytorch_model.bin",
          "adapter_model.bin",  # Delete per formal deprecation policy TBD (per above comment).
          "adapter_model.safetensors",  # New format as of PEFT version "0.7.0" (per above comment).
      }
      if not (files & acceptable_model_artifact_file_nanes):
          raise ValueError(
              f"Can't find model weights at {trained_model_artifacts_path}. Trained model weights should "
              "either be saved as `pytorch_model.bin` for regular model training, or have `adapter_model.bin`"
              "or `adapter_model.safetensors` if using parameter efficient fine-tuning methods like LoRA."
          )
  
imports: from __future__ import annotations
  import logging
  import os
  from abc import ABC, abstractmethod
  from huggingface_hub import HfApi, login
label_desc: Use image node_id 3 for calling the HuggingFaceHub obj's underlying member method code with example usage: obj._validate_upload_parameters(repo_id, model_path, repo_type, private, commit_message, commit_description) without return types