Havi999 commited on
Commit
144c0ad
β€’
1 Parent(s): 8b328c5

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. web_demo.py +5 -3
  2. web_demo2.py +5 -2
  3. web_demo_old.py +5 -3
  4. web_demo_vision.py +5 -3
web_demo.py CHANGED
@@ -4,9 +4,11 @@ import mdtex2html
4
 
5
  # tokenizer = AutoTokenizer.from_pretrained("../chatglm", trust_remote_code=True)
6
  # model = AutoModel.from_pretrained("../chatglm", trust_remote_code=True).float()
7
- tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
8
- model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
9
-
 
 
10
  model = model.eval()
11
 
12
  """Override Chatbot.postprocess"""
 
4
 
5
  # tokenizer = AutoTokenizer.from_pretrained("../chatglm", trust_remote_code=True)
6
  # model = AutoModel.from_pretrained("../chatglm", trust_remote_code=True).float()
7
+ # tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
8
+ # model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
9
+ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True)
10
+ model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
11
+ model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat")
12
  model = model.eval()
13
 
14
  """Override Chatbot.postprocess"""
web_demo2.py CHANGED
@@ -13,8 +13,11 @@ st.set_page_config(
13
  def get_model():
14
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
15
  # model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
16
- tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
17
- model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
 
 
 
18
  model = model.eval()
19
  return tokenizer, model
20
 
 
13
  def get_model():
14
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
15
  # model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
16
+ # tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
17
+ # model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
18
+ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True)
19
+ model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
20
+ model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat")
21
  model = model.eval()
22
  return tokenizer, model
23
 
web_demo_old.py CHANGED
@@ -3,9 +3,11 @@ import gradio as gr
3
 
4
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
5
  # model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
6
- tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
7
- model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
8
-
 
 
9
  model = model.eval()
10
 
11
  MAX_TURNS = 20
 
3
 
4
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True)
5
  # model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
6
+ # tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
7
+ # model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
8
+ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True)
9
+ model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
10
+ model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat")
11
  model = model.eval()
12
 
13
  MAX_TURNS = 20
web_demo_vision.py CHANGED
@@ -4,9 +4,11 @@ import mdtex2html
4
 
5
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True)
6
  # model = AutoModel.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True).half().cuda()
7
- tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
8
- model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
9
-
 
 
10
  model = model.eval()
11
 
12
  """Override Chatbot.postprocess"""
 
4
 
5
  # tokenizer = AutoTokenizer.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True)
6
  # model = AutoModel.from_pretrained("THUDM/visualglm-6b", trust_remote_code=True).half().cuda()
7
+ # tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True)
8
+ # model = AutoModel.from_pretrained("baichuan-inc/Baichuan-13B-Chat", trust_remote_code=True).float()
9
+ tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-13B-Chat", use_fast=False, trust_remote_code=True)
10
+ model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-13B-Chat", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
11
+ model.generation_config = GenerationConfig.from_pretrained("baichuan-inc/Baichuan-13B-Chat")
12
  model = model.eval()
13
 
14
  """Override Chatbot.postprocess"""