code: def wrap_nncf_model(
      model: nn.Module,
      config: dict,
      dataloader: DataLoader,
      init_state_dict: dict,
  ) -> tuple[CompressionAlgorithmController, NNCFNetwork]:
      """Wrap model by NNCF.
  
      :param model: Anomalib model.
      :param config: NNCF config.
      :param dataloader: Dataloader for initialization of NNCF model.
      :param init_state_dict: Opti
      :return: compression controller, compressed model
      """
      nncf_config = NNCFConfig.from_dict(config)
  
      if not dataloader and not init_state_dict:
          logger.warning(
              "Either dataloader or NNCF pre-trained "
              "model checkpoint should be set. Without this, "
              "quantizers will not be initialized"
          )
  
      compression_state = None
      resuming_state_dict = None
      if init_state_dict:
          resuming_state_dict = init_state_dict.get("model")
          compression_state = init_state_dict.get("compression_state")
  
      if dataloader:
          init_loader = InitLoader(dataloader)  # type: ignore
          nncf_config = register_default_init_args(
              nncf_config, init_loader
          )
  
      nncf_ctrl, nncf_model = create_compressed_model(
          model=model,
          config=nncf_config,
          dump_graphs=False,
          compression_state=compression_state,
      )
  
      if resuming_state_dict:
          load_state(nncf_model, resuming_state_dict, is_resume=True)
  
      return nncf_ctrl, nncf_model
  
imports: from __future__ import annotations
  import logging
  from copy import copy
  from typing import Any, Iterator
  from nncf import NNCFConfig
  from nncf.api.compression import CompressionAlgorithmController
  from nncf.torch import create_compressed_model, load_state, register_default_init_args
  from nncf.torch.initialization import PTInitializingDataLoader
  from nncf.torch.nncf_network import NNCFNetwork
  from torch import nn
  from torch.utils.data.dataloader import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: wrap_nncf_model(model, config, dataloader, init_state_dict) and returns: nncf_ctrl,  nncf_model