zhu-mingye commited on
Commit
c1d9331
·
1 Parent(s): 8e60c67

Add use_fast and trust_remote_code for tokenizer compatibility

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,8 +4,8 @@ import torch
4
 
5
  # 加载 CodeT5+ 模型
6
  model_name = "Salesforce/codet5p-220m"
7
- tokenizer = AutoTokenizer.from_pretrained(model_name)
8
- model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
9
 
10
  def generate_code(prompt: str, max_length: int = 128) -> str:
11
  """代码生成/补全"""
 
4
 
5
  # 加载 CodeT5+ 模型
6
  model_name = "Salesforce/codet5p-220m"
7
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True, trust_remote_code=True)
8
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_name, trust_remote_code=True)
9
 
10
  def generate_code(prompt: str, max_length: int = 128) -> str:
11
  """代码生成/补全"""