mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
TEI auto truncate inputs (#10916)
### What problem does this PR solve? TEI auto truncate inputs ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -203,7 +203,7 @@ services:
|
|||||||
env_file: .env
|
env_file: .env
|
||||||
networks:
|
networks:
|
||||||
- ragflow
|
- ragflow
|
||||||
command: ["--model-id", "/data/${TEI_MODEL}"]
|
command: ["--model-id", "/data/${TEI_MODEL}", "--auto-truncate"]
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ services:
|
|||||||
env_file: .env
|
env_file: .env
|
||||||
networks:
|
networks:
|
||||||
- ragflow
|
- ragflow
|
||||||
command: ["--model-id", "/data/${TEI_MODEL}"]
|
command: ["--model-id", "/data/${TEI_MODEL}", "--auto-truncate"]
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
reservations:
|
reservations:
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class BuiltinEmbed(Base):
|
|||||||
|
|
||||||
def encode(self, texts: list):
|
def encode(self, texts: list):
|
||||||
batch_size = 16
|
batch_size = 16
|
||||||
texts = [truncate(t, self._max_tokens) for t in texts]
|
# TEI is able to auto truncate inputs according to https://github.com/huggingface/text-embeddings-inference.
|
||||||
token_count = 0
|
token_count = 0
|
||||||
ress = None
|
ress = None
|
||||||
for i in range(0, len(texts), batch_size):
|
for i in range(0, len(texts), batch_size):
|
||||||
|
|||||||
Reference in New Issue
Block a user