Kevin Hu
commited on
Commit
·
01faf42
1
Parent(s):
3874a3d
Fix transformers dependencies for slim. (#3934)
Browse files### What problem does this PR solve?
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- rag/llm/cv_model.py +2 -1
rag/llm/cv_model.py
CHANGED
|
@@ -25,7 +25,6 @@ import base64
|
|
| 25 |
from io import BytesIO
|
| 26 |
import json
|
| 27 |
import requests
|
| 28 |
-
from transformers import GenerationConfig
|
| 29 |
|
| 30 |
from rag.nlp import is_english
|
| 31 |
from api.utils import get_uuid
|
|
@@ -510,6 +509,7 @@ class GeminiCV(Base):
|
|
| 510 |
return res.text,res.usage_metadata.total_token_count
|
| 511 |
|
| 512 |
def chat(self, system, history, gen_conf, image=""):
|
|
|
|
| 513 |
if system:
|
| 514 |
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
| 515 |
try:
|
|
@@ -533,6 +533,7 @@ class GeminiCV(Base):
|
|
| 533 |
return "**ERROR**: " + str(e), 0
|
| 534 |
|
| 535 |
def chat_streamly(self, system, history, gen_conf, image=""):
|
|
|
|
| 536 |
if system:
|
| 537 |
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
| 538 |
|
|
|
|
| 25 |
from io import BytesIO
|
| 26 |
import json
|
| 27 |
import requests
|
|
|
|
| 28 |
|
| 29 |
from rag.nlp import is_english
|
| 30 |
from api.utils import get_uuid
|
|
|
|
| 509 |
return res.text,res.usage_metadata.total_token_count
|
| 510 |
|
| 511 |
def chat(self, system, history, gen_conf, image=""):
|
| 512 |
+
from transformers import GenerationConfig
|
| 513 |
if system:
|
| 514 |
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
| 515 |
try:
|
|
|
|
| 533 |
return "**ERROR**: " + str(e), 0
|
| 534 |
|
| 535 |
def chat_streamly(self, system, history, gen_conf, image=""):
|
| 536 |
+
from transformers import GenerationConfig
|
| 537 |
if system:
|
| 538 |
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
| 539 |
|