class_docstr: Parameters
  ----------
  model : pytorch model
      The model to be pruned
  config_list : list
      Supported keys:
          - prune_iterations : The number of rounds for the iterative pruning.
          - sparsity : The final sparsity when the compression is done.
  optimizer : pytorch optimizer
      The optimizer for the model
  lr_scheduler : pytorch lr scheduler
      The lr scheduler for the model if used
  reset_weights : bool
      Whether reset weights and optimizer at the beginning of each round.
class_docstr_tok: ["Parameters","--","--","--","--","--","model",":","pytorch","model","The","model","to","be","pruned","config_list",":","list","Supported","keys",":","-","prune_iterations",":","The","number","of","rounds","for","the","iterative","pruning",".","-","sparsity",":","The","final","sparsity","when","the","compression","is","done",".","optimizer",":","pytorch","optimizer","The","optimizer","for","the","model","lr_scheduler",":","pytorch","lr","scheduler","The","lr","scheduler","for","the","model","if","used","reset_weights",":","bool","Whether","reset","weights","and","optimizer","at","the","beginning","of","each","round","."]
code: def __init__(
      self,
      model,
      config_list,
      optimizer=None,
      lr_scheduler=None,
      reset_weights=True,
  ):
      # save init weights and optimizer
      self.reset_weights = reset_weights
      if self.reset_weights:
          self._model = model
          self._optimizer = optimizer
          self._model_state = copy.deepcopy(model.state_dict())
          self._optimizer_state = copy.deepcopy(optimizer.state_dict())
          self._lr_scheduler = lr_scheduler
          if lr_scheduler is not None:
              self._scheduler_state = copy.deepcopy(
                  lr_scheduler.state_dict()
              )
  
      super().__init__(model, config_list, optimizer)
      self.curr_prune_iteration = None
      self.prune_iterations = config_list[0]["prune_iterations"]
      self.masker = LevelPrunerMasker(model, self)
  
file_path: auptimizer/src/aup/compression/torch/pruning/lottery_ticket.py
imports: import copy
  import logging
  import torch
  from schema import And, Optional
  from ..utils.config_validation import CompressorSchema
  from ..compressor import Pruner
  from .finegrained_pruning import LevelPrunerMasker
label_desc: Use image node_id 1 to create a new LotteryTicketPruner object from inherited base classes: Pruner with example: obj = LotteryTicketPruner(model, config_list, optimizer, lr_scheduler, reset_weights)