class_docstr: Class that defines the methods necessary to hook into process.
class_docstr_tok: ["Class","that","defines","the","methods","necessary","to","hook","into","process","."]
code: def on_train_init(
      self,
      base_config,
      experiment_directory,
      experiment_name,
      model_name,
      output_directory,
      resume_directory,
  ):
      if self.cometml_experiment:
          # Comet ML already initialized
          return
  
      try:
          self.cometml_experiment = comet_ml.Experiment(
              log_code=False, project_name=experiment_name
          )
      except Exception:
          self.cometml_experiment = None
          logger.exception(
              "comet_ml.Experiment() had errors. Perhaps you need to define COMET_API_KEY"
          )
          raise
  
      self.cometml_experiment.set_name(model_name)
      self.cometml_experiment.set_filename("Ludwig API")
      config = comet_ml.get_config()
      self._save_config(config, directory=experiment_directory)
  
file_path: ludwig/ludwig/contribs/comet.py
imports: import logging
  import os
  from datetime import datetime
  from ludwig.api_annotations import PublicAPI
  from ludwig.callbacks import Callback
  from ludwig.utils.package_utils import LazyLoader
label_desc: Use image node_id 2 for calling the CometCallback obj's underlying member method code with example usage: obj.on_train_init(base_config, experiment_directory, experiment_name, model_name, output_directory, resume_directory) without return types