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:
parent
2f79a2a04d
commit
19419281c3
1 changed files with 2 additions and 2 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue