diff --git a/haystack/nodes/extractor/entity.py b/haystack/nodes/extractor/entity.py index 4c864de75..9b16528c5 100644 --- a/haystack/nodes/extractor/entity.py +++ b/haystack/nodes/extractor/entity.py @@ -317,7 +317,7 @@ class EntityExtractor(BaseComponent): offset_mapping = model_inputs.pop("offset_mapping", None) overflow_to_sample_mapping = model_inputs.pop("overflow_to_sample_mapping") - logits = self.model(**model_inputs)[0] + logits = self.model(**model_inputs)[0].to(torch.float64) return { "logits": logits, @@ -766,8 +766,8 @@ class _EntityPostProcessor: "score": score, "word": word, "tokens": tokens, - "start": entities[0]["start"], - "end": entities[-1]["end"], + "start": int(entities[0]["start"]), + "end": int(entities[-1]["end"]), } return new_entity diff --git a/releasenotes/notes/fix-entityextractor-json-serialzable-b7d643eb83a3e58c.yaml b/releasenotes/notes/fix-entityextractor-json-serialzable-b7d643eb83a3e58c.yaml new file mode 100644 index 000000000..ad1415b8f --- /dev/null +++ b/releasenotes/notes/fix-entityextractor-json-serialzable-b7d643eb83a3e58c.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fix EntityExtractor output not JSON serializable.