class_docstr: Callback that will save and push the model to the Hub regularly. By default, it pushes once per epoch, but this can
  be changed with the `save_strategy` argument. Pushed models can be accessed like any other model on the hub, such
  as with the `from_pretrained` method.
  
  ```py
  from transformers.keras_callbacks import PushToHubCallback
  
  push_to_hub_callback = PushToHubCallback(
      output_dir="./model_save",
      tokenizer=tokenizer,
      hub_model_id="gpt5-7xlarge",
  )
  
  model.fit(train_dataset, callbacks=[push_to_hub_callback])
  ```
  
  Args:
      output_dir (`str`):
          The output directory where the model predictions and checkpoints will be written and synced with the
          repository on the Hub.
      save_strategy (`str` or [`~trainer_utils.IntervalStrategy`], *optional*, defaults to `"epoch"`):
          The checkpoint save strategy to adopt during training. Possible values are:
  
              - `"no"`: Save is done at the end of training.
              - `"epoch"`: Save is done at the end of each epoch.
              - `"steps"`: Save is done every `save_steps`
      save_steps (`int`, *optional*):
          The number of steps between saves when using the "steps" `save_strategy`.
      tokenizer (`PreTrainedTokenizerBase`, *optional*):
          The tokenizer used by the model. If supplied, will be uploaded to the repo alongside the weights.
      hub_model_id (`str`, *optional*):
          The name of the repository to keep in sync with the local `output_dir`. It can be a simple model ID in
          which case the model will be pushed in your namespace. Otherwise it should be the whole repository name,
          for instance `"user_name/model"`, which allows you to push to an organization you are a member of with
          `"organization_name/model"`.
  
          Will default to the name of `output_dir`.
      hub_token (`str`, *optional*):
          The token to use to push the model to the Hub. Will default to the token in the cache folder obtained with
          `huggingface-cli login`.
      checkpoint (`bool`, *optional*, defaults to `False`):
          Whether to save full training checkpoints (including epoch and optimizer state) to allow training to be
          resumed. Only usable when `save_strategy` is `"epoch"`.
code: def __init__(
      self,
      output_dir: Union[str, Path],
      save_strategy: Union[str, IntervalStrategy] = "epoch",
      save_steps: Optional[int] = None,
      tokenizer: Optional[PreTrainedTokenizerBase] = None,
      hub_model_id: Optional[str] = None,
      hub_token: Optional[str] = None,
      checkpoint: bool = False,
      **model_card_args,
  ):
      super().__init__()
      if checkpoint and save_strategy != "epoch":
          raise ValueError(
              "Cannot save checkpoints when save_strategy is not 'epoch'!"
          )
      if isinstance(save_strategy, str):
          save_strategy = IntervalStrategy(save_strategy.lower())
      self.save_strategy = save_strategy
      if self.save_strategy == IntervalStrategy.STEPS and (
          not isinstance(save_steps, int) or save_steps <= 0
      ):
          raise ValueError(
              "Please supply a positive integer argument for save_steps when save_strategy == 'steps'!"
          )
      self.save_steps = save_steps
      output_dir = Path(output_dir)
  
      # Create repo and retrieve repo_id
      if hub_model_id is None:
          hub_model_id = output_dir.absolute().name
      self.hub_model_id = create_repo(
          repo_id=hub_model_id, exist_ok=True, token=hub_token
      ).repo_id
  
      self.output_dir = output_dir
      self.repo = Repository(
          str(self.output_dir),
          clone_from=self.hub_model_id,
          token=hub_token,
      )
  
      self.tokenizer = tokenizer
      self.last_job = None
      self.checkpoint = checkpoint
      self.training_history = None
      self.model_card_args = model_card_args
  
imports: import logging
  import os
  from pathlib import Path
  from time import sleep
  from typing import Callable, List, Optional, Union
  import numpy
  import tensorflow
  from huggingface_hub import Repository, create_repo
  from packaging.version import parse
  from tensorflow.keras.callbacks import Callback
  from .None import IntervalStrategy, PreTrainedTokenizerBase
  from .modelcard import TrainingSummary
label_desc: Use image node_id 1 to create a new PushToHubCallback object from inherited base classes: Callback with example: obj = PushToHubCallback(output_dir, save_strategy, save_steps, tokenizer, hub_model_id, hub_token, checkpoint)