class_docstr: Solver for compression task.
  
  The compression task combines a set of perceptual and objective losses
  to train an EncodecModel (composed of an encoder-decoder and a quantizer)
  to perform high fidelity audio reconstruction.
class_docstr_tok: ["Solver","for","compression","task",".","The","compression","task","combines","a","set","of","perceptual","and","objective","losses","to","train","an","EncodecModel","(","composed","of","an","encoder-decoder","and","a","quantizer",")","to","perform","high","fidelity","audio","reconstruction","."]
code: def __init__(self, cfg: omegaconf.DictConfig):
      super().__init__(cfg)
      self.rng: torch.Generator  # set at each epoch
      self.adv_losses = builders.get_adversarial_losses(self.cfg)
      self.aux_losses = nn.ModuleDict()
      self.info_losses = nn.ModuleDict()
      assert (
          not cfg.fsdp.use
      ), "FSDP not supported by CompressionSolver."
      loss_weights = dict()
      for loss_name, weight in self.cfg.losses.items():
          if loss_name in ["adv", "feat"]:
              for adv_name, _ in self.adv_losses.items():
                  loss_weights[f"{loss_name}_{adv_name}"] = weight
          elif weight > 0:
              self.aux_losses[loss_name] = builders.get_loss(
                  loss_name, self.cfg
              )
              loss_weights[loss_name] = weight
          else:
              self.info_losses[loss_name] = builders.get_loss(
                  loss_name, self.cfg
              )
      self.balancer = builders.get_balancer(
          loss_weights, self.cfg.balancer
      )
      self.register_stateful("adv_losses")
  
imports: import logging
  import multiprocessing
  from pathlib import Path
  import typing
  import flashy
  import omegaconf
  import torch
  from torch import nn
  from .None import base, builders
  from ..None import models, quantization
  from ..utils import checkpoint
  from ..utils.samples.manager import SampleManager
  from ..utils.utils import get_pool_executor
label_desc: Use image node_id 1 to create a new CompressionSolver object from inherited base classes: base with example: obj = CompressionSolver(cfg)