class_docstr: Component that checks whether fine-tuning is possible.
  
  This is a component at the beginning of the graph which receives all training data
  and raises an exception in case `is_finetuning` is `True` and finetuning is not
  possible (e.g. because new labels were added).
  In case we are doing a regular training (and not finetuning) this persists the
  necessary information extracted from the training data to be able to validate when
  initialized via load whether we can finetune.
  
  Finetuning is possible if, compared to the initial training phase, it holds that
  1. the configuration (except for "epoch" keys) does not change
  2. the domain (except for e.g. "responses") does not change - or we're not
     finetuning the core part
  3. the intents, entities, entity groups, entity roles, and action names that
     appeared in the original NLU training data, appear in the NLU training data
     used for finetuning, and no new such items (i.e. intents, entities, entity
     groups, entity roles, or action names) have been added, compared to the original
     training data - or we're not finetuning the nlu part.
  Note that even though conditions 2. and 3. differ based on which part we finetune,
  condition 1. always covers both parts, i.e. NLU and Core.
class_docstr_tok: ["Component","that","checks","whether","fine-tuning","is","possible",".","This","is","a","component","at","the","beginning","of","the","graph","which","receives","all","training","data","and","raises","an","exception","in","case","`","is_finetuning","`","is","`","True","`","and","finetuning","is","not","possible","(","e.g",".","because","new","labels","were","added",")",".","In","case","we","are","doing","a","regular","training","(","and","not","finetuning",")","this","persists","the","necessary","information","extracted","from","the","training","data","to","be","able","to","validate","when","initialized","via","load","whether","we","can","finetune",".","Finetuning","is","possible","if",",","compared","to","the","initial","training","phase",",","it","holds","that","1.","the","configuration","(","except","for","``","epoch","''","keys",")","does","not","change","2.","the","domain","(","except","for","e.g",".","``","responses","''",")","does","not","change","-","or","we","'re","not","finetuning","the","core","part","3.","the","intents",",","entities",",","entity","groups",",","entity","roles",",","and","action","names","that","appeared","in","the","original","NLU","training","data",",","appear","in","the","NLU","training","data","used","for","finetuning",",","and","no","new","such","items","(","i.e",".","intents",",","entities",",","entity","groups",",","entity","roles",",","or","action","names",")","have","been","added",",","compared","to","the","original","training","data","-","or","we","'re","not","finetuning","the","nlu","part",".","Note","that","even","though","conditions","2.","and","3.","differ","based","on","which","part","we","finetune",",","condition","1.","always","covers","both","parts",",","i.e",".","NLU","and","Core","."]
docstr: Validate whether the finetuning setting conflicts with other settings.
  
  Note that this validation always takes into account the configuration of
  nlu *and* core part, while the validation of aspects of the domain and
  the NLU training data only happen if we request to validate finetuning
  with respect to NLU/Core models, respectively.
  
  For more details, see docstring of this class.
  
  Args:
      importer: a training data importer
  
  Raises:
      `InvalidConfigException` if there is a conflict
docstr_tok: ["Validate","whether","the","finetuning","setting","conflicts","with","other","settings",".","Note","that","this","validation","always","takes","into","account","the","configuration","of","nlu","*","and","*","core","part",",","while","the","validation","of","aspects","of","the","domain","and","the","NLU","training","data","only","happen","if","we","request","to","validate","finetuning","with","respect","to","NLU\/Core","models",",","respectively",".","For","more","details",",","see","docstring","of","this","class",".","Args",":","importer",":","a","training","data","importer","Raises",":","`","InvalidConfigException","`","if","there","is","a","conflict"]
code: def _validate(self, importer: TrainingDataImporter) -> None:
      """Validate whether the finetuning setting conflicts with other settings.
  
      Note that this validation always takes into account the configuration of
      nlu *and* core part, while the validation of aspects of the domain and
      the NLU training data only happen if we request to validate finetuning
      with respect to NLU/Core models, respectively.
  
      For more details, see docstring of this class.
  
      Args:
          importer: a training data importer
  
      Raises:
          `InvalidConfigException` if there is a conflict
      """
      if self._is_finetuning and not self._fingerprints:
          raise InvalidConfigException(
              f"Finetuning is enabled but the {self.__class__.__name__} "
              f"does not remember seeing a training run. Ensure that you have "
              f"trained your model at least once (with finetuning disabled) "
              f"and ensure that the  {self.__class__.__name__} is part of the "
              f"training graph. "
          )
  
      rasa_version = rasa.__version__
      if self._is_finetuning:
          old_rasa_version = self._fingerprints[FINGERPRINT_VERSION]
          if version.parse(old_rasa_version) < version.parse(
              MINIMUM_COMPATIBLE_VERSION
          ):
              raise InvalidConfigException(
                  f"The minimum compatible Rasa Version is "
                  f"{MINIMUM_COMPATIBLE_VERSION} but the model we attempt to "
                  f"finetune has been generated with an older version "
                  f"({old_rasa_version}."
              )
      self._fingerprints[FINGERPRINT_VERSION] = rasa_version
  
      fingerprint_config = (
          self._get_fingerprint_of_schema_without_irrelevant_keys()
      )
      self._compare_or_memorize(
          fingerprint_key=FINGERPRINT_CONFIG,
          new_fingerprint=fingerprint_config,
          error_message=(
              "Cannot finetune because more than just the 'epoch' keys have been "
              "changed in the configuration. "
              "Please revert your configuration and only change "
              "the 'epoch' settings where needed."
          ),
      )
  
      if self._core:
          # NOTE: If there's a consistency check between domain and core training data
          # that ensures domain and core training data are consistent, then we can
          # drop this check.
          fingerprint_core = (
              self._get_fingerprint_of_domain_pruned_for_core(
                  domain=importer.get_domain()
              )
          )
          self._compare_or_memorize(
              fingerprint_key=FINGERPRINT_CORE,
              new_fingerprint=fingerprint_core,
              error_message=(
                  "Cannot finetune because keys that affect the training of core "
                  "components have changed."
                  "Please revert all settings in your domain file that affect the "
                  "training of core components."
              ),
          )
  
      if self._nlu:
          fingerprint_nlu = importer.get_nlu_data().label_fingerprint()
          self._compare_or_memorize(
              fingerprint_key=FINGERPRINT_NLU,
              new_fingerprint=fingerprint_nlu,
              error_message=(
                  "Cannot finetune because NLU training data contains new labels "
                  "or does not contain any examples for some known labels. "
                  "Please make sure that the NLU data that you use "
                  "for finetuning contains at least one example for every label "
                  "(i.e. intent, action name, ...) that was included in the NLU "
                  "data used for training the model which we attempt to finetune "
                  "now. Moreover, you must not add labels that were not included "
                  "during training before. "
              ),
          )
  
      self.persist()
  
imports: from __future__ import annotations
  from typing import Dict, Text, Any, Optional
  import copy
  import logging
  from packaging import version
  from rasa.constants import MINIMUM_COMPATIBLE_VERSION
  from rasa.engine.graph import GraphComponent, ExecutionContext
  from rasa.engine.storage.storage import ModelStorage
  from rasa.engine.storage.resource import Resource
  from rasa.shared.exceptions import InvalidConfigException
  from rasa.shared.core.domain import Domain
  from rasa.shared.importers.importer import TrainingDataImporter
  import rasa.shared.utils.io
  from rasa.utils.tensorflow.constants import EPOCHS
  from rasa.graph_components.providers.domain_for_core_training_provider import DomainForCoreTrainingProvider
label_desc: Use image node_id 4 for calling the FinetuningValidator obj's underlying member method code with example usage: obj._validate(importer) without return types