mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Fix: Change Ollama Embedding Keep Alive (#8734)
### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/8733 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -286,7 +286,7 @@ class OllamaEmbed(Base):
|
|||||||
# remove special tokens if they exist
|
# remove special tokens if they exist
|
||||||
for token in OllamaEmbed._special_tokens:
|
for token in OllamaEmbed._special_tokens:
|
||||||
txt = txt.replace(token, "")
|
txt = txt.replace(token, "")
|
||||||
res = self.client.embeddings(prompt=txt, model=self.model_name, options={"use_mmap": True})
|
res = self.client.embeddings(prompt=txt, model=self.model_name, options={"use_mmap": True}, keep_alive=-1)
|
||||||
try:
|
try:
|
||||||
arr.append(res["embedding"])
|
arr.append(res["embedding"])
|
||||||
except Exception as _e:
|
except Exception as _e:
|
||||||
@ -298,7 +298,7 @@ class OllamaEmbed(Base):
|
|||||||
# remove special tokens if they exist
|
# remove special tokens if they exist
|
||||||
for token in OllamaEmbed._special_tokens:
|
for token in OllamaEmbed._special_tokens:
|
||||||
text = text.replace(token, "")
|
text = text.replace(token, "")
|
||||||
res = self.client.embeddings(prompt=text, model=self.model_name, options={"use_mmap": True})
|
res = self.client.embeddings(prompt=text, model=self.model_name, options={"use_mmap": True}, keep_alive=-1)
|
||||||
try:
|
try:
|
||||||
return np.array(res["embedding"]), 128
|
return np.array(res["embedding"]), 128
|
||||||
except Exception as _e:
|
except Exception as _e:
|
||||||
|
|||||||
Reference in New Issue
Block a user