free-x commited on
Commit
583270e
·
1 Parent(s): 265c842

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,7 +7,7 @@ from transformers import pipeline
7
  from transformers import AutoTokenizer, AutoModelForCausalLM
8
 
9
  # 下载模型
10
- base_dir = "/root/.cache/huggingface/hub"
11
  if not os.path.isdir(base_dir):
12
  os.makedirs(base_dir)
13
 
@@ -18,8 +18,8 @@ ret, out = subprocess.getstatusoutput(cmd_str)
18
  print("ret:", ret)
19
  print("out:", out)
20
 
21
- tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path="/root/.cache/huggingface/hub/models")
22
- model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path="/root/.cache/huggingface/hub/models")
23
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
24
 
25
  # generator = pipeline('text-generation', model='gpt2')
 
7
  from transformers import AutoTokenizer, AutoModelForCausalLM
8
 
9
  # 下载模型
10
+ base_dir = ".cache/huggingface/hub"
11
  if not os.path.isdir(base_dir):
12
  os.makedirs(base_dir)
13
 
 
18
  print("ret:", ret)
19
  print("out:", out)
20
 
21
+ tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path=".cache/huggingface/hub/models")
22
+ model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path=".cache/huggingface/hub/models")
23
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
24
 
25
  # generator = pipeline('text-generation', model='gpt2')