Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #25 from botfront/fix/stories-fingerprint
Browse files Browse the repository at this point in the history
fix: fix oversensitive story fingerprint
  • Loading branch information
pheel authored Jul 13, 2020
2 parents 36aa24a + de4efdd commit 263211f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion addons_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests==2.22.0
requests==2.23.0
requests_futures==0.9.9
fuzzy_matcher==0.1.0
fbmessenger==6.00
Expand Down
4 changes: 2 additions & 2 deletions rasa/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async def model_fingerprint(file_importer: "TrainingDataImporter") -> Fingerprin
# bf mod
config = await file_importer.get_config()
domain = await file_importer.get_domain()
stories = await file_importer.get_stories()
stories_hash = await file_importer.get_stories_hash()
nlu_data = await file_importer.get_nlu_data()

nlu_config = await file_importer.get_nlu_config()
Expand All @@ -311,7 +311,7 @@ async def model_fingerprint(file_importer: "TrainingDataImporter") -> Fingerprin
FINGERPRINT_NLG_KEY: get_dict_hash(templates),
FINGERPRINT_NLU_DATA_KEY: {lang: hash(nlu_data[lang])
for lang in nlu_data},
FINGERPRINT_STORIES_KEY: hash(stories),
FINGERPRINT_STORIES_KEY: stories_hash,
FINGERPRINT_TRAINED_AT_KEY: time.time(),
FINGERPRINT_RASA_VERSION_KEY: rasa.__version__,
}
Expand Down
2 changes: 0 additions & 2 deletions rasa_addons/core/policies/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def predict_action_probabilities(

idx = domain.index_for_action(ACTION_LISTEN_NAME)
prediction[idx] = 1
else:
logger.debug("Predicted intent is not handled by BotfrontMappingPolicy.")
return prediction

def persist(self, path: Text) -> None:
Expand Down
5 changes: 5 additions & 0 deletions rasa_addons/importers/botfront.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ async def get_stories(
)
return StoryGraph(story_steps)

async def get_stories_hash(self):
# Use a file hash of stories file to figure out Core fingerprint, instead of
# storygraph object hash which is unstable
return get_file_hash(self._story_files[0])

async def get_nlu_data(self, languages=True) -> Dict[Text, TrainingData]:
language = None
if isinstance(languages, str):
Expand Down

0 comments on commit 263211f

Please sign in to comment.