improve dockerfile
This commit is contained in:
parent
bf44dd1d41
commit
40d91e9e1a
@ -36,6 +36,9 @@ from transformers import AutoModel, AutoTokenizer \n\
|
|||||||
chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
|
chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
|
||||||
chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
|
chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
|
||||||
RUN python3 -u warm_up_chatglm.py
|
RUN python3 -u warm_up_chatglm.py
|
||||||
|
|
||||||
|
# 禁用缓存,确保更新代码
|
||||||
|
ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
|
||||||
RUN $useProxyNetwork git pull
|
RUN $useProxyNetwork git pull
|
||||||
|
|
||||||
# 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
|
# 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
|
||||||
|
@ -23,6 +23,9 @@ from .bridge_tgui import predict as tgui_ui
|
|||||||
|
|
||||||
colors = ['#FF00FF', '#00FFFF', '#FF0000', '#990099', '#009999', '#990044']
|
colors = ['#FF00FF', '#00FFFF', '#FF0000', '#990099', '#009999', '#990044']
|
||||||
|
|
||||||
|
get_token_num_gpt35 = lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=()))
|
||||||
|
get_token_num_gpt4 = lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=()))
|
||||||
|
|
||||||
model_info = {
|
model_info = {
|
||||||
# openai
|
# openai
|
||||||
"gpt-3.5-turbo": {
|
"gpt-3.5-turbo": {
|
||||||
@ -31,7 +34,7 @@ model_info = {
|
|||||||
"endpoint": "https://api.openai.com/v1/chat/completions",
|
"endpoint": "https://api.openai.com/v1/chat/completions",
|
||||||
"max_token": 4096,
|
"max_token": 4096,
|
||||||
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
||||||
"token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
|
"token_cnt": get_token_num_gpt35,
|
||||||
},
|
},
|
||||||
|
|
||||||
"gpt-4": {
|
"gpt-4": {
|
||||||
@ -40,7 +43,7 @@ model_info = {
|
|||||||
"endpoint": "https://api.openai.com/v1/chat/completions",
|
"endpoint": "https://api.openai.com/v1/chat/completions",
|
||||||
"max_token": 8192,
|
"max_token": 8192,
|
||||||
"tokenizer": tiktoken.encoding_for_model("gpt-4"),
|
"tokenizer": tiktoken.encoding_for_model("gpt-4"),
|
||||||
"token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=())),
|
"token_cnt": get_token_num_gpt4,
|
||||||
},
|
},
|
||||||
|
|
||||||
# api_2d
|
# api_2d
|
||||||
@ -50,7 +53,7 @@ model_info = {
|
|||||||
"endpoint": "https://openai.api2d.net/v1/chat/completions",
|
"endpoint": "https://openai.api2d.net/v1/chat/completions",
|
||||||
"max_token": 4096,
|
"max_token": 4096,
|
||||||
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
||||||
"token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
|
"token_cnt": get_token_num_gpt35,
|
||||||
},
|
},
|
||||||
|
|
||||||
"api2d-gpt-4": {
|
"api2d-gpt-4": {
|
||||||
@ -59,7 +62,7 @@ model_info = {
|
|||||||
"endpoint": "https://openai.api2d.net/v1/chat/completions",
|
"endpoint": "https://openai.api2d.net/v1/chat/completions",
|
||||||
"max_token": 8192,
|
"max_token": 8192,
|
||||||
"tokenizer": tiktoken.encoding_for_model("gpt-4"),
|
"tokenizer": tiktoken.encoding_for_model("gpt-4"),
|
||||||
"token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=())),
|
"token_cnt": get_token_num_gpt4,
|
||||||
},
|
},
|
||||||
|
|
||||||
# chatglm
|
# chatglm
|
||||||
@ -69,7 +72,7 @@ model_info = {
|
|||||||
"endpoint": None,
|
"endpoint": None,
|
||||||
"max_token": 1024,
|
"max_token": 1024,
|
||||||
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
"tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
|
||||||
"token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
|
"token_cnt": get_token_num_gpt35,
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user