mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
error when using embedding models. the backend is OpenAI-API-compatible, sglang. #293
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hahchenchen on GitHub (May 19, 2025).
Self Checks
Dify version
1.3.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
using the backend is OpenAI-API-compatible, sglang. the embedding model is intfloat/e5-mistral-7b-instruct.
When constructing a knowledge base using this model, embedding failed.
the sglang error log is:File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_fast.py", line 539, in _batch_encode_plus
encodings = self._tokenizer.encode_batch(
TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]]
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
@dosubot[bot] commented on GitHub (May 19, 2025):
Hello @hahchenchen! I'm Dosu, a bot here to help you solve bugs, answer your questions, and guide you as you become a contributor. I'm ready to assist you while we wait for a human maintainer. Let's tackle this together!
The error you're encountering,
TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]], typically arises from incorrect input types being passed to the tokenizer. Here are some steps you can take to troubleshoot and resolve this issue:Check Input Format: Ensure that the input to the tokenizer is in the correct format. The input should be either a single sequence of text or a tuple containing two sequences. Verify that the data being passed matches these requirements.
Update Dependencies: Make sure that all dependencies, especially the
transformerslibrary, are up to date. Sometimes, issues like these are resolved in newer versions of libraries.Review Backend Configuration: Double-check the configuration of the sglang backend to ensure it is correctly set up to handle the embedding model. There might be specific settings or requirements for using the
intfloat/e5-mistral-7b-instructmodel.Debugging Logs: Examine the logs for any additional error messages or warnings that might provide more context about the issue. This can help pinpoint where the input is being mishandled.
If these steps do not resolve the issue, consider isolating the problem by testing with a different embedding model or backend to see if the error persists. This can help determine if the issue is specific to the model or the backend configuration.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other