Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from transformers import pipeline
|
|
7 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
|
9 |
# 下载模型
|
10 |
-
base_dir = "
|
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="
|
22 |
-
model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path="
|
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')
|