code: def scheduler_kwargs(cfg, decreasing_metric: Optional[bool] = None):
      """cfg/argparse to kwargs helper
      Convert scheduler args in argparse args or cfg (.dot) like object to keyword args.
      """
      eval_metric = getattr(cfg, "eval_metric", "top1")
      if decreasing_metric is not None:
          plateau_mode = "min" if decreasing_metric else "max"
      else:
          plateau_mode = "min" if "loss" in eval_metric else "max"
      kwargs = dict(
          sched=cfg.sched,
          num_epochs=getattr(cfg, "epochs", 100),
          decay_epochs=getattr(cfg, "decay_epochs", 30),
          decay_milestones=getattr(cfg, "decay_milestones", [30, 60]),
          warmup_epochs=getattr(cfg, "warmup_epochs", 5),
          cooldown_epochs=getattr(cfg, "cooldown_epochs", 0),
          patience_epochs=getattr(cfg, "patience_epochs", 10),
          decay_rate=getattr(cfg, "decay_rate", 0.1),
          min_lr=getattr(cfg, "min_lr", 0.0),
          warmup_lr=getattr(cfg, "warmup_lr", 1e-5),
          warmup_prefix=getattr(cfg, "warmup_prefix", False),
          noise=getattr(cfg, "lr_noise", None),
          noise_pct=getattr(cfg, "lr_noise_pct", 0.67),
          noise_std=getattr(cfg, "lr_noise_std", 1.0),
          noise_seed=getattr(cfg, "seed", 42),
          cycle_mul=getattr(cfg, "lr_cycle_mul", 1.0),
          cycle_decay=getattr(cfg, "lr_cycle_decay", 0.1),
          cycle_limit=getattr(cfg, "lr_cycle_limit", 1),
          k_decay=getattr(cfg, "lr_k_decay", 1.0),
          plateau_mode=plateau_mode,
          step_on_epochs=not getattr(cfg, "sched_on_updates", False),
      )
      return kwargs
  
file_path: pytorch-image-models/timm/scheduler/scheduler_factory.py
imports: from typing import List, Optional, Union
  from torch.optim import Optimizer
  from .cosine_lr import CosineLRScheduler
  from .multistep_lr import MultiStepLRScheduler
  from .plateau_lr import PlateauLRScheduler
  from .poly_lr import PolyLRScheduler
  from .step_lr import StepLRScheduler
  from .tanh_lr import TanhLRScheduler
label_desc: Use image node_id 1 for calling a global function with example usage: scheduler_kwargs(cfg, decreasing_metric) and returns: kwargs