From dab9d9f7163c42bfc527478595749c7788ebcf89 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Thu, 19 Sep 2024 10:52:18 +0100 Subject: [PATCH] fix: model lang --- nlu/data_loaders/jisfdl.py | 4 ++-- nlu/models/intent_classifier.py | 2 +- nlu/models/slot_filler.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nlu/data_loaders/jisfdl.py b/nlu/data_loaders/jisfdl.py index 7c4096e..18f8a89 100644 --- a/nlu/data_loaders/jisfdl.py +++ b/nlu/data_loaders/jisfdl.py @@ -102,10 +102,10 @@ class JISFDL(tfbp.DataLoader): lang = self.hparams.language all_examples = data["common_examples"] - if not lang: + if not bool(lang): examples = all_examples else: - examples = filter(lambda exp: any(not lang or (e['entity'] == 'language' and e['value'] == lang) for e in exp['entities']), all_examples) + examples = filter(lambda exp: any(e['entity'] == 'language' and e['value'] == lang for e in exp['entities']), all_examples) # Parse raw data for exp in examples: diff --git a/nlu/models/intent_classifier.py b/nlu/models/intent_classifier.py index 2d2f27c..5491cb8 100644 --- a/nlu/models/intent_classifier.py +++ b/nlu/models/intent_classifier.py @@ -38,7 +38,7 @@ BERT_MODEL_BY_LANGUAGE = { @tfbp.default_export class IntentClassifier(tfbp.Model): default_hparams = { - "language": None, + "language": "", "num_epochs": 2, "dropout_prob": 0.1, "intent_num_labels": 7, diff --git a/nlu/models/slot_filler.py b/nlu/models/slot_filler.py index 81eb54a..0393fb3 100644 --- a/nlu/models/slot_filler.py +++ b/nlu/models/slot_filler.py @@ -38,7 +38,7 @@ BERT_MODEL_BY_LANGUAGE = { @tfbp.default_export class SlotFiller(tfbp.Model): default_hparams = { - "language": None, + "language": "", "num_epochs": 2, "dropout_prob": 0.1, "slot_num_labels": 40