class_docstr: Sharpness-Aware Minimization that simultaneously minimizes loss value and loss sharpness.
  In particular, it seeks parameters that lie in neighborhoods having uniformly low loss.
code: def __init__(
      self, params, base_optimizer, rho=0.05, adaptive=False, **kwargs
  ):
      assert rho >= 0.0, f"Invalid rho, should be non-negative: {rho}"
  
      defaults = dict(rho=rho, adaptive=adaptive, **kwargs)
      self.param_groups = []
      super().__init__(params, defaults)
  
      self.base_optimizer = base_optimizer(self.param_groups, **kwargs)
      self.param_groups = self.base_optimizer.param_groups
  
file_path: towhee/towhee/models/layers/sam.py
imports: import torch
label_desc: Use image node_id 1 to create a new SAM object from inherited base classes: torch.optim with example: obj = SAM(params, base_optimizer, rho, adaptive)