mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[PR #669] [MERGED] fix: Optimize the text embedding model by replacing the server's /tokenize interface #1488
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?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/669
Author: @hikariming
Created: 4/7/2025
Status: ✅ Merged
Merged: 4/7/2025
Merged by: @crazywoola
Base:
main← Head:main📝 Commits (1)
5967b85优化文本嵌入模型,使用GPT2分词器替代服务器的/tokenize接口,简化了token计数逻辑,并调整了文本截断方式以提高性能。📊 Changes
1 file changed (+12 additions, -29 deletions)
View changed files
📝
models/huggingface_tei/models/text_embedding/text_embedding.py(+12 -29)📄 Description
Related Issue or Context
Optimize the text embedding model by replacing the server's /tokenize interface (which frequently throws errors on Huawei and NVIDIA GPUs) with the GPT2 tokenizer. Simplify the token counting logic and adjust the text truncation method to improve performance.
Alternatively, if you'd like a more concise version:
Optimized the text embedding model by switching to the GPT2 tokenizer (replacing the error-prone /tokenize interface on Huawei/NVIDIA GPUs), simplifying token counting, and adjusting text truncation for better performance.
Fix https://github.com/langgenius/dify/issues/15035
Type of Change
Version Control (if applicable)
Versionfield, not in Meta section)Test Evidence (if applicable)
Screenshots or Video/GIF:
Environment Verification
Local Deployment Environment
Local Deployment Dify Version:
SaaS Environment
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.