From 6c2277affa658b9b586fe4d80f904f2825d8e00b Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Fri, 13 Oct 2023 16:36:35 +0200 Subject: [PATCH] Fix processing of optional embeddings. --- spacy_llm/tasks/entity_linker/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy_llm/tasks/entity_linker/util.py b/spacy_llm/tasks/entity_linker/util.py index 0f49ea5d..a5ec35ec 100644 --- a/spacy_llm/tasks/entity_linker/util.py +++ b/spacy_llm/tasks/entity_linker/util.py @@ -170,7 +170,9 @@ def __call__(self, vocab: Vocab) -> Tuple[InMemoryLookupKB, DescFormat]: qids = list(entities.keys()) kb = InMemoryLookupKB( vocab=vocab, - entity_vector_length=len(kb_data["entities"][qids[0]]["embedding"]), + entity_vector_length=len( + kb_data["entities"][qids[0]].get("embedding", [0]) + ), ) # Set entities (with dummy values for frequencies).