IEIT-Yuan commited on
Commit
7c83f01
Β·
verified Β·
1 Parent(s): 62929e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,11 +10,11 @@ sys.path.append(
10
  from transformers import AutoModelForCausalLM,AutoTokenizer,LlamaTokenizer
11
 
12
  print("Creat tokenizer...")
13
- tokenizer = LlamaTokenizer.from_pretrained('IEITYuan/Yuan2-2B-hf', add_eos_token=False, add_bos_token=False, eos_token='<eod>')
14
  tokenizer.add_tokens(['<sep>', '<pad>', '<mask>', '<predict>', '<FIM_SUFFIX>', '<FIM_PREFIX>', '<FIM_MIDDLE>','<commit_before>','<commit_msg>','<commit_after>','<jupyter_start>','<jupyter_text>','<jupyter_code>','<jupyter_output>','<empty_output>'], special_tokens=True)
15
 
16
  print("Creat model...")
17
- model = AutoModelForCausalLM.from_pretrained('IEITYuan/Yuan2-2B-hf', device_map='auto', torch_dtype=torch.bfloat16, trust_remote_code=True)
18
  # using CUDA for an optimal experience
19
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
20
  model = model.to(device)
 
10
  from transformers import AutoModelForCausalLM,AutoTokenizer,LlamaTokenizer
11
 
12
  print("Creat tokenizer...")
13
+ tokenizer = LlamaTokenizer.from_pretrained('IEITYuan/Yuan2-2B-Janus-hf', add_eos_token=False, add_bos_token=False, eos_token='<eod>')
14
  tokenizer.add_tokens(['<sep>', '<pad>', '<mask>', '<predict>', '<FIM_SUFFIX>', '<FIM_PREFIX>', '<FIM_MIDDLE>','<commit_before>','<commit_msg>','<commit_after>','<jupyter_start>','<jupyter_text>','<jupyter_code>','<jupyter_output>','<empty_output>'], special_tokens=True)
15
 
16
  print("Creat model...")
17
+ model = AutoModelForCausalLM.from_pretrained('IEITYuan/Yuan2-2B-Janus-hf', device_map='auto', torch_dtype=torch.bfloat16, trust_remote_code=True)
18
  # using CUDA for an optimal experience
19
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
20
  model = model.to(device)