Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Fix HuggingFace NER kwargs handling (#1188)

Shahzaib Ahmadd3f37f798e0e
diff --git a/semantica/semantic_extract/methods.py b/semantica/semantic_extract/methods.py
index f0559dec..e7ac62b2 100644
--- a/semantica/semantic_extract/methods.py
+++ b/semantica/semantic_extract/methods.py
@@ -779,9 +779,11 @@ def extract_entities_huggingface(
"""
loader = HuggingFaceModelLoader(device=device)
# Pass kwargs (like aggregation_strategy) to load_ner_model
- model_obj = loader.load_ner_model(model, **kwargs)
+ loader_kwargs = {
+ key: value for key, value in kwargs.items() if key != "huggingface_model"
+ }
+ model_obj = loader.load_ner_model(model, **loader_kwargs)
results = loader.extract_entities(model_obj, text)
-
entities = []
# Check if manual aggregation is needed (raw IOB tags detected)