3v324v23 commited on
Commit
40d91e9
1 Parent(s): bf44dd1

improve dockerfile

Browse files
docs/Dockerfile+ChatGLM CHANGED
@@ -36,6 +36,9 @@ from transformers import AutoModel, AutoTokenizer \n\
36
  chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
37
  chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
38
  RUN python3 -u warm_up_chatglm.py
 
 
 
39
  RUN $useProxyNetwork git pull
40
 
41
  # 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
 
36
  chatglm_tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) \n\
37
  chatglm_model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).float() ' >> warm_up_chatglm.py
38
  RUN python3 -u warm_up_chatglm.py
39
+
40
+ # 禁用缓存,确保更新代码
41
+ ADD "https://www.random.org/cgi-bin/randbyte?nbytes=10&format=h" skipcache
42
  RUN $useProxyNetwork git pull
43
 
44
  # 为chatgpt-academic配置代理和API-KEY (非必要 可选步骤)
request_llm/bridge_all.py CHANGED
@@ -23,6 +23,9 @@ from .bridge_tgui import predict as tgui_ui
23
 
24
  colors = ['#FF00FF', '#00FFFF', '#FF0000', '#990099', '#009999', '#990044']
25
 
 
 
 
26
  model_info = {
27
  # openai
28
  "gpt-3.5-turbo": {
@@ -31,7 +34,7 @@ model_info = {
31
  "endpoint": "https://api.openai.com/v1/chat/completions",
32
  "max_token": 4096,
33
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
34
- "token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
35
  },
36
 
37
  "gpt-4": {
@@ -40,7 +43,7 @@ model_info = {
40
  "endpoint": "https://api.openai.com/v1/chat/completions",
41
  "max_token": 8192,
42
  "tokenizer": tiktoken.encoding_for_model("gpt-4"),
43
- "token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=())),
44
  },
45
 
46
  # api_2d
@@ -50,7 +53,7 @@ model_info = {
50
  "endpoint": "https://openai.api2d.net/v1/chat/completions",
51
  "max_token": 4096,
52
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
53
- "token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
54
  },
55
 
56
  "api2d-gpt-4": {
@@ -59,7 +62,7 @@ model_info = {
59
  "endpoint": "https://openai.api2d.net/v1/chat/completions",
60
  "max_token": 8192,
61
  "tokenizer": tiktoken.encoding_for_model("gpt-4"),
62
- "token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=())),
63
  },
64
 
65
  # chatglm
@@ -69,7 +72,7 @@ model_info = {
69
  "endpoint": None,
70
  "max_token": 1024,
71
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
72
- "token_cnt": lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=())),
73
  },
74
 
75
  }
 
23
 
24
  colors = ['#FF00FF', '#00FFFF', '#FF0000', '#990099', '#009999', '#990044']
25
 
26
+ get_token_num_gpt35 = lambda txt: len(tiktoken.encoding_for_model("gpt-3.5-turbo").encode(txt, disallowed_special=()))
27
+ get_token_num_gpt4 = lambda txt: len(tiktoken.encoding_for_model("gpt-4").encode(txt, disallowed_special=()))
28
+
29
  model_info = {
30
  # openai
31
  "gpt-3.5-turbo": {
 
34
  "endpoint": "https://api.openai.com/v1/chat/completions",
35
  "max_token": 4096,
36
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
37
+ "token_cnt": get_token_num_gpt35,
38
  },
39
 
40
  "gpt-4": {
 
43
  "endpoint": "https://api.openai.com/v1/chat/completions",
44
  "max_token": 8192,
45
  "tokenizer": tiktoken.encoding_for_model("gpt-4"),
46
+ "token_cnt": get_token_num_gpt4,
47
  },
48
 
49
  # api_2d
 
53
  "endpoint": "https://openai.api2d.net/v1/chat/completions",
54
  "max_token": 4096,
55
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
56
+ "token_cnt": get_token_num_gpt35,
57
  },
58
 
59
  "api2d-gpt-4": {
 
62
  "endpoint": "https://openai.api2d.net/v1/chat/completions",
63
  "max_token": 8192,
64
  "tokenizer": tiktoken.encoding_for_model("gpt-4"),
65
+ "token_cnt": get_token_num_gpt4,
66
  },
67
 
68
  # chatglm
 
72
  "endpoint": None,
73
  "max_token": 1024,
74
  "tokenizer": tiktoken.encoding_for_model("gpt-3.5-turbo"),
75
+ "token_cnt": get_token_num_gpt35,
76
  },
77
 
78
  }