update requirements

This commit is contained in:
hiyouga 2023-11-06 19:01:21 +08:00
parent de95b69282
commit 66a91e1fe3
4 changed files with 8 additions and 9 deletions

View File

@ -1,9 +1,10 @@
torch>=1.13.1
transformers>=4.31.0
transformers>=4.31.0,<4.35.0
datasets>=2.12.0
accelerate>=0.21.0
peft>=0.4.0
trl>=0.7.2
gradio>=3.38.0,<4.0.0
scipy
sentencepiece
protobuf
@ -12,9 +13,8 @@ fire
jieba
rouge-chinese
nltk
gradio==3.50.2
uvicorn
pydantic==1.10.11
fastapi==0.95.1
pydantic
fastapi
sse-starlette
matplotlib

View File

@ -32,9 +32,9 @@ async def lifespan(app: FastAPI): # collects GPU memory
def to_json(data: BaseModel) -> str:
try:
try: # pydantic v2
return json.dumps(data.model_dump(exclude_unset=True), ensure_ascii=False)
except:
except: # pydantic v1
return data.json(exclude_unset=True, ensure_ascii=False)

View File

@ -14,7 +14,6 @@ from transformers import (
PreTrainedTokenizerBase
)
from transformers.models.llama import modeling_llama as LlamaModule
from transformers.utils import check_min_version
from transformers.utils.versions import require_version
from trl import AutoModelForCausalLMWithValueHead
@ -39,7 +38,7 @@ if TYPE_CHECKING:
logger = get_logger(__name__)
check_min_version("4.31.0")
require_version("transformers>=4.31.0,<4.35.0", "To fix: pip install \"transformers>=4.31.0,<4.35.0\"")
require_version("datasets>=2.12.0", "To fix: pip install datasets>=2.12.0")
require_version("accelerate>=0.21.0", "To fix: pip install accelerate>=0.21.0")
require_version("peft>=0.4.0", "To fix: pip install peft>=0.4.0")

View File

@ -14,7 +14,7 @@ from llmtuner.webui.css import CSS
from llmtuner.webui.engine import Engine
require_version("gradio==3.50.2", "To fix: pip install gradio==3.50.2")
require_version("gradio>=3.38.0,<4.0.0", "To fix: pip install \"gradio>=3.38.0,<4.0.0\"")
def create_ui() -> gr.Blocks: