mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
[PR #866] [MERGED] Remove transformers dependencies on Llama API plugin #1599
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/866
Author: @Riandy
Created: 5/6/2025
Status: ✅ Merged
Merged: 5/6/2025
Merged by: @crazywoola
Base:
main← Head:llama-api-fix-transformers📝 Commits (1)
d11c1a3Remove transformers dependencies📊 Changes
3 files changed (+3 additions, -6 deletions)
View changed files
📝
models/llama_api/manifest.yaml(+2 -2)📝
models/llama_api/models/llm/llm.py(+1 -3)📝
models/llama_api/requirements.txt(+0 -1)📄 Description
https://github.com/langgenius/dify-official-plugins/pull/845 introduced Llama API plugin.
Initially we are using transformers package to count tokens, but somehow the production version of dify has this weird error
I suspect it's related to some transformers package dependencies version incompatibility or something.
Upon digging futher, looks like dify provide a util function to count an approximate tokens using _get_num_tokens_by_gpt2()
I saw many model providers are using that too, and hence migrating to that and removing transformers as a package dependencies.
I tested this by building the dify plugin manually, and upload it into dify cloud (prod) and test it out, and how the error no longer appears.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.