docstr: Method creates IntentSlotDataDesc and copies generated values to cfg.data_desc. 
docstr_tok: ["Method","creates","IntentSlotDataDesc","and","copies","generated","values","to","cfg.data_desc","."]
code: def _set_data_desc_to_cfg(
      self, cfg, data_dir, train_ds, validation_ds
  ):
      """Method creates IntentSlotDataDesc and copies generated values to cfg.data_desc."""
      # Save data from data desc to config - so it can be reused later, e.g. in inference.
      data_desc = IntentSlotDataDesc(
          data_dir=data_dir,
          modes=[train_ds.prefix, validation_ds.prefix],
      )
      OmegaConf.set_struct(cfg, False)
      if not hasattr(cfg, "data_desc") or cfg.data_desc is None:
          cfg.data_desc = {}
      # Intents.
      cfg.data_desc.intent_labels = list(
          data_desc.intents_label_ids.keys()
      )
      cfg.data_desc.intent_label_ids = data_desc.intents_label_ids
      cfg.data_desc.intent_weights = data_desc.intent_weights
      # Slots.
      cfg.data_desc.slot_labels = list(data_desc.slots_label_ids.keys())
      cfg.data_desc.slot_label_ids = data_desc.slots_label_ids
      cfg.data_desc.slot_weights = data_desc.slot_weights
  
      cfg.data_desc.pad_label = data_desc.pad_label
  
      # for older(pre - 1.0.0.b3) configs compatibility
      if not hasattr(cfg, "class_labels") or cfg.class_labels is None:
          cfg.class_labels = {}
          cfg.class_labels = OmegaConf.create(
              {
                  "intent_labels_file": "intent_labels.csv",
                  "slot_labels_file": "slot_labels.csv",
              }
          )
  
      slot_labels_file = os.path.join(
          data_dir, cfg.class_labels.slot_labels_file
      )
      intent_labels_file = os.path.join(
          data_dir, cfg.class_labels.intent_labels_file
      )
      self._save_label_ids(data_desc.slots_label_ids, slot_labels_file)
      self._save_label_ids(
          data_desc.intents_label_ids, intent_labels_file
      )
  
      self.register_artifact(
          "class_labels.intent_labels_file", intent_labels_file
      )
      self.register_artifact(
          "class_labels.slot_labels_file", slot_labels_file
      )
      OmegaConf.set_struct(cfg, True)
  
imports: import os
  from typing import Dict, List, Optional
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from torch.utils.data import DataLoader
  from nemo.collections.common.losses import AggregatorLoss, CrossEntropyLoss
  from nemo.collections.nlp.data.dialogue.data_processor.assistant_data_processor import DialogueAssistantDataProcessor
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_bert_dataset import DialogueBERTDataset, DialogueIntentSlotInferenceDataset
  from nemo.collections.nlp.data.intent_slot_classification import IntentSlotDataDesc
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport
  from nemo.collections.nlp.metrics.dialogue_metrics import DialogueClassificationMetrics
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.modules.common import SequenceTokenClassifier
  from nemo.collections.nlp.parts.utils_funcs import tensor2list
  from nemo.core.classes import typecheck
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the IntentSlotClassificationModel obj's underlying member method code with example usage: obj._set_data_desc_to_cfg(cfg, data_dir, train_ds, validation_ds) without return types