code: def push_to_hub(
      self,
      save_directory: str,
      repository_id: str,
      private: Optional[bool] = None,
      use_auth_token: Union[bool, str] = True,
  ) -> str:
      if isinstance(use_auth_token, str):
          huggingface_token = use_auth_token
      elif use_auth_token:
          huggingface_token = HfFolder.get_token()
      else:
          raise ValueError(
              "You need to proivde `use_auth_token` to be able to push to the hub"
          )
      api = HfApi()
  
      user = api.whoami(huggingface_token)
      self.git_config_username_and_email(
          git_email=user["email"], git_user=user["fullname"]
      )
  
      api.create_repo(
          token=huggingface_token,
          repo_id=repository_id,
          exist_ok=True,
          private=private,
      )
      for path, subdirs, files in os.walk(save_directory):
          for name in files:
              local_file_path = os.path.join(path, name)
              _, hub_file_path = os.path.split(local_file_path)
              # FIXME: when huggingface_hub fixes the return of upload_file
              try:
                  api.upload_file(
                      token=huggingface_token,
                      repo_id=f"{repository_id}",
                      path_or_fileobj=os.path.join(
                          os.getcwd(), local_file_path
                      ),
                      path_in_repo=hub_file_path,
                  )
              except KeyError:
                  pass
              except NameError:
                  pass
  
imports: import logging
  import os
  import subprocess
  from abc import ABC, abstractmethod
  from pathlib import Path
  from typing import TYPE_CHECKING, Optional, Union
  from huggingface_hub import HfApi, HfFolder
  from transformers import AutoConfig, PretrainedConfig, add_start_docstrings
  from .exporters import TasksManager
  from .utils import CONFIG_NAME
label_desc: Use image node_id 7 for calling the OptimizedModel obj's underlying member method code with example usage: obj.push_to_hub(save_directory, repository_id, private, use_auth_token) without return types