misc: update requirements.txt, polish docs, improve error logging (#234) (#234)

- feat: Improve ModelWorker's error printing
- chore: bump requirement.txt for guanaco support
- docs: fix some typos in Tutorials
This commit is contained in:
magic.chen 2023-06-16 12:38:28 +08:00 committed by GitHub
commit 6d2ae97200
6 changed files with 22 additions and 11 deletions

View File

@ -33,11 +33,11 @@ Currently, we have released multiple key features, which are listed below to dem
Getting Started Getting Started
----------------- -----------------
| How to get started using DB-GPT to interact with your data and environment. | How to get started using DB-GPT to interact with your data and environment.
- `Quickstart Guid <./getting_started/getting_started.html>`_ - `Quickstart Guide <./getting_started/getting_started.html>`_
| Concepts and terminology | Concepts and terminology
- `Concepts and terminology <./getting_started/concepts.html>`_ - `Concepts and Terminology <./getting_started/concepts.html>`_
| Coming soon... | Coming soon...

View File

@ -34,19 +34,19 @@ msgid ""
msgstr "" msgstr ""
#: ../../getting_started/tutorials.md:8 b5e106a97bbd4467b071bb05d837d7d9 #: ../../getting_started/tutorials.md:8 b5e106a97bbd4467b071bb05d837d7d9
msgid "Introduce" msgid "Introduction"
msgstr "" msgstr ""
#: ../../getting_started/tutorials.md:9 9df43436183d4b41a75a09fec15743d7 #: ../../getting_started/tutorials.md:9 9df43436183d4b41a75a09fec15743d7
#, fuzzy #, fuzzy
msgid "[What is DB-GPT](https://www.youtube.com/watch?v=QszhVJerc0I)" msgid "[What is DB-GPT](https://www.youtube.com/watch?v=QszhVJerc0I)"
msgstr "" msgstr ""
"###Introduce [什么是DB-" "###Introduction [什么是DB-"
"GPT](https://www.bilibili.com/video/BV1SM4y1a7Nj/?buvid=551b023900b290f9497610b2155a2668&is_story_h5=false&mid=%2BVyE%2Fwau5woPcUKieCWS0A%3D%3D&p=1&plat_id=116&share_from=ugc&share_medium=iphone&share_plat=ios&share_session_id=5D08B533-82A4-4D40-9615-7826065B4574&share_source=GENERIC&share_tag=s_i&timestamp=1686307943&unique_k=bhO3lgQ&up_id=31375446)" "GPT](https://www.bilibili.com/video/BV1SM4y1a7Nj/?buvid=551b023900b290f9497610b2155a2668&is_story_h5=false&mid=%2BVyE%2Fwau5woPcUKieCWS0A%3D%3D&p=1&plat_id=116&share_from=ugc&share_medium=iphone&share_plat=ios&share_session_id=5D08B533-82A4-4D40-9615-7826065B4574&share_source=GENERIC&share_tag=s_i&timestamp=1686307943&unique_k=bhO3lgQ&up_id=31375446)"
" by csunny (https://github.com/csunny/DB-GPT)" " by csunny (https://github.com/csunny/DB-GPT)"
#: ../../getting_started/tutorials.md:11 3096811f862649bf84ff3cd29cdf14db #: ../../getting_started/tutorials.md:11 3096811f862649bf84ff3cd29cdf14db
msgid "Knowledge" msgid "Knowledge Base"
msgstr "知识库" msgstr "知识库"
#: ../../getting_started/tutorials.md:13 ea00f3de8c754bf2950e735a2f14043a #: ../../getting_started/tutorials.md:13 ea00f3de8c754bf2950e735a2f14043a

View File

@ -43,6 +43,8 @@ LLM_MODEL_CONFIG = {
"guanaco-33b-merged": os.path.join(MODEL_PATH, "guanaco-33b-merged"), "guanaco-33b-merged": os.path.join(MODEL_PATH, "guanaco-33b-merged"),
"falcon-40b": os.path.join(MODEL_PATH, "falcon-40b"), "falcon-40b": os.path.join(MODEL_PATH, "falcon-40b"),
"gorilla-7b": os.path.join(MODEL_PATH, "gorilla-7b"), "gorilla-7b": os.path.join(MODEL_PATH, "gorilla-7b"),
# TODO Support baichuan-7b
# "baichuan-7b" : os.path.join(MODEL_PATH, "baichuan-7b"),
"gptj-6b": os.path.join(MODEL_PATH, "ggml-gpt4all-j-v1.3-groovy.bin"), "gptj-6b": os.path.join(MODEL_PATH, "ggml-gpt4all-j-v1.3-groovy.bin"),
"proxyllm": "proxyllm", "proxyllm": "proxyllm",
} }

View File

@ -32,9 +32,14 @@ class BaseLLMAdaper:
return True return True
def loader(self, model_path: str, from_pretrained_kwargs: dict): def loader(self, model_path: str, from_pretrained_kwargs: dict):
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False) tokenizer = AutoTokenizer.from_pretrained(
model_path, use_fast=False, trust_remote_code=True
)
model = AutoModelForCausalLM.from_pretrained( model = AutoModelForCausalLM.from_pretrained(
model_path, low_cpu_mem_usage=True, **from_pretrained_kwargs model_path,
low_cpu_mem_usage=True,
trust_remote_code=True,
**from_pretrained_kwargs,
) )
return model, tokenizer return model, tokenizer
@ -57,7 +62,7 @@ def get_llm_model_adapter(model_path: str) -> BaseLLMAdaper:
raise ValueError(f"Invalid model adapter for {model_path}") raise ValueError(f"Invalid model adapter for {model_path}")
# TODO support cpu? for practise we support gpt4all or chatglm-6b-int4? # TODO support cpu? for practice we support gpt4all or chatglm-6b-int4?
class VicunaLLMAdapater(BaseLLMAdaper): class VicunaLLMAdapater(BaseLLMAdaper):

View File

@ -5,6 +5,7 @@ import asyncio
import json import json
import os import os
import sys import sys
import traceback
import uvicorn import uvicorn
from fastapi import BackgroundTasks, FastAPI, Request from fastapi import BackgroundTasks, FastAPI, Request
@ -89,10 +90,13 @@ class ModelWorker:
ret = {"text": "**GPU OutOfMemory, Please Refresh.**", "error_code": 0} ret = {"text": "**GPU OutOfMemory, Please Refresh.**", "error_code": 0}
yield json.dumps(ret).encode() + b"\0" yield json.dumps(ret).encode() + b"\0"
except Exception as e: except Exception as e:
msg = "{}: {}".format(str(e), traceback.format_exc())
ret = { ret = {
"text": f"**LLMServer Generate Error, Please CheckErrorInfo.**: {e}", "text": f"**LLMServer Generate Error, Please CheckErrorInfo.**: {msg}",
"error_code": 0, "error_code": 0,
} }
yield json.dumps(ret).encode() + b"\0" yield json.dumps(ret).encode() + b"\0"
def get_embeddings(self, prompt): def get_embeddings(self, prompt):

View File

@ -4,7 +4,7 @@ aiohttp==3.8.4
aiosignal==1.3.1 aiosignal==1.3.1
async-timeout==4.0.2 async-timeout==4.0.2
attrs==22.2.0 attrs==22.2.0
bitsandbytes==0.37.0 bitsandbytes==0.39.0
cchardet==2.1.7 cchardet==2.1.7
chardet==5.1.0 chardet==5.1.0
contourpy==1.0.7 contourpy==1.0.7
@ -27,7 +27,7 @@ python-dateutil==2.8.2
pyyaml==6.0 pyyaml==6.0
tokenizers==0.13.2 tokenizers==0.13.2
tqdm==4.64.1 tqdm==4.64.1
transformers==4.28.0 transformers==4.30.0
timm==0.6.13 timm==0.6.13
spacy==3.5.3 spacy==3.5.3
webdataset==0.2.48 webdataset==0.2.48