def __init__( self, config_file: Text, domain_path: Optional[Text] = None, training_data_paths: Optional[Union[List[Text], Text]] = None, project_directory: Optional[Text] = None, ): self.config = rasa.shared.utils.io.read_model_configuration( config_file) if domain_path: self._domain_paths = [domain_path] else: self._domain_paths = [] self._story_paths = [] self._e2e_story_paths = [] self._nlu_paths = [] self._imports = [] self._additional_paths = training_data_paths or [] self._project_directory = project_directory or os.path.dirname( config_file) self._init_from_dict(self.config, self._project_directory) extra_nlu_files = rasa.shared.data.get_data_files( training_data_paths, rasa.shared.data.is_nlu_file) extra_story_files = rasa.shared.data.get_data_files( training_data_paths, YAMLStoryReader.is_stories_file) self._story_paths += extra_story_files self._nlu_paths += extra_nlu_files logger.debug("Selected projects: {}".format("".join( [f"\n-{i}" for i in self._imports]))) mark_as_experimental_feature(feature_name="MultiProjectImporter")
def graph_config_for_recipe( self, config: Dict, cli_parameters: Dict[Text, Any], training_type: TrainingType = TrainingType.BOTH, is_finetuning: bool = False, ) -> GraphModelConfiguration: """Converts the default config to graphs (see interface for full docstring).""" mark_as_experimental_feature("graph recipe") if cli_parameters or is_finetuning: raise_warning( "Unlike the Default Recipe, Graph Recipe does not utilize CLI " "parameters or finetuning and these configurations will be ignored. " "Add configuration to the recipe itself if you want them to be used.", docs=DOCS_URL_GRAPH_RECIPE, ) nlu_target, core_target = self.get_targets(config, training_type) return GraphModelConfiguration( train_schema=GraphSchema.from_dict(config.get("train_schema")), predict_schema=GraphSchema.from_dict(config.get("predict_schema")), training_type=training_type, language=config.get("language"), core_target=core_target, nlu_target=nlu_target, )
def __init__( self, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, model: Optional[RasaModel] = None, featurizer: Optional[TrackerFeaturizer] = None, fake_features: Optional[Dict[Text, List[Features]]] = None, entity_tag_specs: Optional[List[EntityTagSpec]] = None, label_quantiles: Optional[Dict[int, List[float]]] = None, ): """Declares instance variables with default values.""" # Set all invalid / non configurable parameters config[ENTITY_RECOGNITION] = False config[BILOU_FLAG] = False config[SIMILARITY_TYPE] = INNER config[LOSS_TYPE] = CROSS_ENTROPY self.config = config super().__init__( self.config, model_storage, resource, execution_context, model, featurizer, fake_features, entity_tag_specs, ) self.label_quantiles = label_quantiles or {} self.label_thresholds = ( self._pick_thresholds(self.label_quantiles, self.config[TOLERANCE]) if self.label_quantiles else {} ) self.ignore_intent_list = self.config[IGNORE_INTENTS_LIST] common.mark_as_experimental_feature("UnexpecTED Intent Policy")
def __init__( self, featurizer: Optional[TrackerFeaturizer] = None, priority: int = UNLIKELY_INTENT_POLICY_PRIORITY, max_history: Optional[int] = None, model: Optional[RasaModel] = None, fake_features: Optional[Dict[Text, List["Features"]]] = None, entity_tag_specs: Optional[List[EntityTagSpec]] = None, should_finetune: bool = False, label_quantiles: Optional[Dict[int, List[float]]] = None, **kwargs: Any, ) -> None: """Declares instance variables with default values.""" super().__init__( featurizer, priority, max_history, model, fake_features, entity_tag_specs, should_finetune, **kwargs, ) self.label_quantiles = label_quantiles or {} self.label_thresholds = (self._pick_thresholds(self.label_quantiles, self.config[TOLERANCE]) if self.label_quantiles else {}) self.ignore_intent_list = self.config[IGNORE_INTENTS_LIST] # Set all invalid / non configurable parameters self.config[ENTITY_RECOGNITION] = False self.config[BILOU_FLAG] = False self.config[SIMILARITY_TYPE] = INNER self.config[LOSS_TYPE] = CROSS_ENTROPY common.mark_as_experimental_feature("UnexpecTED Intent Policy")