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_artifacts(
      cls, fine_tune: FineTuningJob, project: str, entity: Optional[str]
  ) -> None:
      # training/validation files
      training_file = (
          fine_tune.training_file if fine_tune.training_file else None
      )
      validation_file = (
          fine_tune.validation_file
          if fine_tune.validation_file
          else None
      )
      for file, prefix, artifact_type in (
          (training_file, "train", "training_files"),
          (validation_file, "valid", "validation_files"),
      ):
          if file is not None:
              cls._log_artifact_inputs(
                  file, prefix, artifact_type, project, entity
              )
  
      # fine-tune details
      fine_tune_id = fine_tune.id
      artifact = wandb.Artifact(
          "model_metadata",
          type="model",
          metadata=dict(fine_tune),
      )
      with artifact.new_file(
          "model_metadata.json", mode="w", encoding="utf-8"
      ) as f:
          dict_fine_tune = dict(fine_tune)
          dict_fine_tune["hyperparameters"] = dict(
              dict_fine_tune["hyperparameters"]
          )
          json.dump(dict_fine_tune, f, indent=2)
      cls._run.log_artifact(
          artifact,
          aliases=["latest", fine_tune_id],
      )
  
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 9 for calling the WandbLogger obj's underlying member method code with example usage: obj._log_artifacts(cls, fine_tune, project, entity) without return types