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.
docstr: Control the pruning procedure on updated epoch number.
  Should be called at the beginning of the epoch.
docstr_tok: ["Control","the","pruning","procedure","on","updated","epoch","number",".","Should","be","called","at","the","beginning","of","the","epoch","."]
code: def prune_iteration_start(self):
      """
      Control the pruning procedure on updated epoch number.
      Should be called at the beginning of the epoch.
      """
      if self.curr_prune_iteration is None:
          self.curr_prune_iteration = 0
      else:
          self.curr_prune_iteration += 1
      assert (
          self.curr_prune_iteration < self.prune_iterations + 1
      ), "Exceed the configured prune_iterations"
  
      modules_wrapper = self.get_modules_wrapper()
      modules_to_compress = self.get_modules_to_compress()
      for layer, config in modules_to_compress:
          module_wrapper = None
          for wrapper in modules_wrapper:
              if wrapper.name == layer.name:
                  module_wrapper = wrapper
                  break
          assert module_wrapper is not None
  
          sparsity = config.get("sparsity")
          mask = self._calc_mask(module_wrapper, sparsity)
          # TODO: directly use weight_mask is not good
          module_wrapper.weight_mask = mask["weight_mask"]
          # there is no mask for bias
  
      # reinit weights back to original after new masks are generated
      if self.reset_weights:
          # should use this member function to reset model weights
          self.load_model_state_dict(self._model_state)
          self._optimizer.load_state_dict(self._optimizer_state)
          if self._lr_scheduler is not None:
              self._lr_scheduler.load_state_dict(self._scheduler_state)
  
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 7 for calling the LotteryTicketPruner obj's underlying member method code with example usage: obj.prune_iteration_start() without return types