class_docstr: Log OpenAI fine-tunes to [Weights & Biases](https://wandb.me/openai-docs).
class_docstr_tok: ["Log","OpenAI","fine-tunes","to","[","Weights","&","Biases","]","(","https",":","\/\/wandb.me\/openai-docs",")","."]
code: def _log_fine_tune(
      cls,
      fine_tune: FineTuningJob,
      project: str,
      entity: Optional[str],
      overwrite: bool,
      show_individual_warnings: bool,
      **kwargs_wandb_init: Dict[str, Any],
  ):
      fine_tune_id = fine_tune.id
      status = fine_tune.status
  
      with telemetry.context(run=cls._run) as tel:
          tel.feature.openai_finetuning = True
  
      # check run completed successfully
      if status != "succeeded":
          if show_individual_warnings:
              wandb.termwarn(
                  f'Fine-tune {fine_tune_id} has the status "{status}" and will not be logged'
              )
          return
  
      # check results are present
      try:
          results_id = fine_tune.result_files[0]
          results = cls.openai_client.files.retrieve_content(
              file_id=results_id
          )
      except openai.NotFoundError:
          if show_individual_warnings:
              wandb.termwarn(
                  f"Fine-tune {fine_tune_id} has no results and will not be logged"
              )
          return
  
      # update the config
      cls._run.config.update(cls._get_config(fine_tune))
  
      # log results
      df_results = pd.read_csv(io.StringIO(results))
      for _, row in df_results.iterrows():
          metrics = {k: v for k, v in row.items() if not np.isnan(v)}
          step = metrics.pop("step")
          if step is not None:
              step = int(step)
          cls._run.log(metrics, step=step)
      fine_tuned_model = fine_tune.fine_tuned_model
      if fine_tuned_model is not None:
          cls._run.summary["fine_tuned_model"] = fine_tuned_model
  
      # training/validation files and fine-tune details
      cls._log_artifacts(fine_tune, project, entity)
  
      # mark run as complete
      cls._run.summary["status"] = "succeeded"
  
      cls._run.finish()
      return True
  
imports: import datetime
  import io
  import json
  import re
  import time
  from typing import Any, Dict, Optional, Tuple
  from pkg_resources import parse_version
  import wandb
  from wandb import util
  from wandb.data_types import Table
  from wandb.sdk.lib import telemetry
  from wandb.sdk.wandb_run import Run
  from openai import OpenAI
  from openai.types.fine_tuning import FineTuningJob
  from openai.types.fine_tuning.fine_tuning_job import Hyperparameters
label_desc: Use image node_id 3 for calling the WandbLogger obj's underlying member method code with example usage: obj._log_fine_tune(cls, fine_tune, project, entity, overwrite, show_individual_warnings) and returns: True