class_docstr: comet sweep.
  
  Args:
      config (DictConfig): Original model configuration.
      sweep_config (DictConfig): Sweep configuration.
      entity (str, optional): Username or workspace to send the project to. Defaults to None.
class_docstr_tok: ["comet","sweep",".","Args",":","config","(","DictConfig",")",":","Original","model","configuration",".","sweep_config","(","DictConfig",")",":","Sweep","configuration",".","entity","(","str",",","optional",")",":","Username","or","workspace","to","send","the","project","to",".","Defaults","to","None","."]
docstr: Run the sweep.
docstr_tok: ["Run","the","sweep","."]
code: def run(self) -> None:
      """Run the sweep."""
      flattened_hpo_params = flatten_hpo_params(
          self.sweep_config.parameters
      )
      self.sweep_config.parameters = flattened_hpo_params
  
      # comet's Optimizer takes dict as an input, not DictConfig
      std_dict = OmegaConf.to_object(self.sweep_config)
  
      opt = Optimizer(std_dict)
  
      project_name = (
          f"{self.config.model.name}_{self.config.dataset.name}"
      )
  
      for experiment in opt.get_experiments(project_name=project_name):
          comet_logger = CometLogger(workspace=self.entity)
  
          # allow pytorch-lightning to use the experiment from optimizer
          comet_logger._experiment = (
              experiment  # pylint: disable=protected-access
          )
          run_params = experiment.params
          for param in run_params.keys():
              # this check is needed as comet also returns model and sweep_config as keys
              if param in self.sweep_config.parameters.keys():
                  set_in_nested_config(
                      self.config, param.split("."), run_params[param]
                  )
          config = update_input_size_config(self.config)
  
          model = get_model(config)
          datamodule = get_datamodule(config)
          callbacks = get_sweep_callbacks(config)
  
          # Disable saving checkpoints as all checkpoints from the sweep will get uploaded
          config.trainer.enable_checkpointing = False
  
          trainer = pl.Trainer(
              **config.trainer, logger=comet_logger, callbacks=callbacks
          )
          trainer.fit(model, datamodule=datamodule)
  
imports: from __future__ import annotations
  import gc
  import pytorch_lightning
  import torch
  import wandb
  from comet_ml import Optimizer
  from omegaconf import DictConfig, ListConfig, OmegaConf
  from pytorch_lightning.loggers import CometLogger, WandbLogger
  from anomalib.config import update_input_size_config
  from anomalib.data import get_datamodule
  from anomalib.models import get_model
  from anomalib.utils.sweep import flatten_sweep_params, get_sweep_callbacks, set_in_nested_config
  from .config import flatten_hpo_params
label_desc: Use image node_id 2 for calling the CometSweep obj's underlying member method code with example usage: obj.run() without return types