Skip to content

Commit

Permalink
Fix transformers dependencies for slim. (#3934)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Dec 9, 2024
1 parent 4b00be4 commit 044afa8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rag/llm/cv_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from io import BytesIO
import json
import requests
from transformers import GenerationConfig

from rag.nlp import is_english
from api.utils import get_uuid
Expand Down Expand Up @@ -510,6 +509,7 @@ def describe(self, image, max_tokens=2048):
return res.text,res.usage_metadata.total_token_count

def chat(self, system, history, gen_conf, image=""):
from transformers import GenerationConfig
if system:
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
try:
Expand All @@ -533,6 +533,7 @@ def chat(self, system, history, gen_conf, image=""):
return "**ERROR**: " + str(e), 0

def chat_streamly(self, system, history, gen_conf, image=""):
from transformers import GenerationConfig
if system:
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]

Expand Down

0 comments on commit 044afa8

Please sign in to comment.