class_docstr: Log losses, metrics, model weights, model architecture summary to neptune
class_docstr_tok: ["Log","losses",",","metrics",",","model","weights",",","model","architecture","summary","to","neptune"]
code: def before_fit(self):
      try:
          self.experiment = comet_ml.Experiment(
              project_name=self.project_name
          )
      except ValueError:
          print("No active experiment")
  
      try:
          self.experiment.log_parameter(
              "n_epoch", str(self.learn.n_epoch)
          )
          self.experiment.log_parameter(
              "model_class", str(type(self.learn.model))
          )
      except:
          print(f"Did not log all properties.")
  
      try:
          with tempfile.NamedTemporaryFile(mode="w") as f:
              with open(f.name, "w") as g:
                  g.write(repr(self.learn.model))
              self.experiment.log_asset(f.name, "model_summary.txt")
      except:
          print(
              "Did not log model summary. Check if your model is PyTorch model."
          )
  
      if self.log_model_weights and not hasattr(
          self.learn, "save_model"
      ):
          print(
              "Unable to log model to Comet.\n",
          )
  
file_path: fastai/fastai/callback/comet.py
imports: from __future__ import annotations
  import tempfile
  from ..basics import *
  from ..learner import Callback
  import comet_ml
label_desc: Use image node_id 2 for calling the CometCallback obj's underlying member method code with example usage: obj.before_fit() without return types