Fix HuggingFace NER kwargs handling (#1188)

Co-authored-by: Shahzaib Ahmad <malikshahzaib7145@example.com>
Co-authored-by: Zohaib Hassnain <109234410+ZohaibHassan16@users.noreply.github.com>
This commit is contained in:
Shahzaib Ahmad
2026-08-22 20:56:15 +05:00
committed by GitHub
co-authored by Shahzaib Ahmad Zohaib Hassnain
parent 3c99f447e6
commit d3f37f798e
+4 -2
View File
@@ -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)