Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not filter training data in model.py but on component side #6930

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rasa/nlu/classifiers/keyword_intent_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def train(
) -> None:

duplicate_examples = set()
for ex in training_data.training_examples:
for ex in training_data.intent_examples:
if (
ex.get(TEXT) in self.intent_keyword_map.keys()
and ex.get(INTENT) != self.intent_keyword_map[ex.get(TEXT)]
Expand Down
2 changes: 1 addition & 1 deletion rasa/nlu/extractors/crf_entity_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def train(

# filter out pre-trained entity examples
entity_examples = self.filter_trainable_entities(
training_data.training_examples
training_data.entity_examples
)

dataset = [self._convert_to_crf_tokens(example) for example in entity_examples]
Expand Down
2 changes: 1 addition & 1 deletion rasa/nlu/extractors/mitie_entity_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def train(

# filter out pre-trained entity examples
filtered_entity_examples = self.filter_trainable_entities(
training_data.training_examples
training_data.entity_examples
)

for example in filtered_entity_examples:
Expand Down
1 change: 0 additions & 1 deletion rasa/nlu/extractors/regex_entity_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Any, Dict, List, Optional, Text

import rasa.shared.utils.io
import rasa.utils.io as io_utils
import rasa.nlu.utils.pattern_utils as pattern_utils
from rasa.nlu.model import Metadata
from rasa.nlu.config import RasaNLUModelConfig
Expand Down
3 changes: 0 additions & 3 deletions rasa/nlu/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ def train(self, data: TrainingData, **kwargs: Any) -> "Interpreter":
working_data: TrainingData = copy.deepcopy(data)

for i, component in enumerate(self.pipeline):
if isinstance(component, (EntityExtractor, IntentClassifier)):
working_data = working_data.without_empty_e2e_examples()

logger.info(f"Starting to train component {component.name}")
component.prepare_partial_processing(self.pipeline[:i], context)
updates = component.train(working_data, self.config, **context)
Expand Down