class_docstr: Solver for compression task.
  
  The diffusion task allows for MultiBand diffusion model training.
  
  Args:
      cfg (DictConfig): Configuration.
class_docstr_tok: ["Solver","for","compression","task",".","The","diffusion","task","allows","for","MultiBand","diffusion","model","training",".","Args",":","cfg","(","DictConfig",")",":","Configuration","."]
code: def __init__(self, cfg: omegaconf.DictConfig):
      super().__init__(cfg)
      self.cfg = cfg
      self.device = cfg.device
      self.sample_rate: int = self.cfg.sample_rate
      self.codec_model = CompressionSolver.model_from_checkpoint(
          cfg.compression_model_checkpoint, device=self.device
      )
  
      self.codec_model.set_num_codebooks(cfg.n_q)
      assert self.codec_model.sample_rate == self.cfg.sample_rate, (
          f"Codec model sample rate is {self.codec_model.sample_rate} but "
          f"Solver sample rate is {self.cfg.sample_rate}."
      )
      assert self.codec_model.sample_rate == self.sample_rate, (
          f"Sample rate of solver {self.sample_rate} and codec {self.codec_model.sample_rate} "
          "don't match."
      )
  
      self.sample_processor = get_processor(
          cfg.processor, sample_rate=self.sample_rate
      )
      self.register_stateful("sample_processor")
      self.sample_processor.to(self.device)
  
      self.schedule = NoiseSchedule(
          **cfg.schedule,
          device=self.device,
          sample_processor=self.sample_processor,
      )
  
      self.eval_metric: tp.Optional[torch.nn.Module] = None
  
      self.rvm = RelativeVolumeMel()
      self.data_processor = DataProcess(
          initial_sr=self.sample_rate,
          target_sr=cfg.resampling.target_sr,
          use_resampling=cfg.resampling.use,
          cutoffs=cfg.filter.cutoffs,
          use_filter=cfg.filter.use,
          n_bands=cfg.filter.n_bands,
          idx_band=cfg.filter.idx_band,
          device=self.device,
      )
  
imports: import typing
  import flashy
  import julius
  import omegaconf
  import torch
  import torch.nn.functional
  from .None import builders
  from .None import base
  from ..None import models
  from ..modules.diffusion_schedule import NoiseSchedule
  from ..metrics import RelativeVolumeMel
  from ..models.builders import get_processor
  from ..utils.samples.manager import SampleManager
  from ..solvers.compression import CompressionSolver
label_desc: Use image node_id 1 to create a new DiffusionSolver object from inherited base classes: base with example: obj = DiffusionSolver(cfg)