Spaces:
Runtime error
Runtime error
Add key
Browse files- .gitignore +1 -0
- app.py +4 -1
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
venv
|
app.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
import gradio as gr
|
3 |
#import peft
|
4 |
import transformers
|
|
|
5 |
|
6 |
device = "cpu"
|
7 |
is_peft = False
|
@@ -12,7 +13,9 @@ model_id = "treadon/promt-fungineer-355M"
|
|
12 |
# tokenizer = transformers.AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
13 |
# model = peft.PeftModel.from_pretrained(model, model_id)
|
14 |
# else:
|
15 |
-
|
|
|
|
|
16 |
tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2")
|
17 |
|
18 |
def generate_text(prompt):
|
|
|
2 |
import gradio as gr
|
3 |
#import peft
|
4 |
import transformers
|
5 |
+
import os
|
6 |
|
7 |
device = "cpu"
|
8 |
is_peft = False
|
|
|
13 |
# tokenizer = transformers.AutoTokenizer.from_pretrained(config.base_model_name_or_path)
|
14 |
# model = peft.PeftModel.from_pretrained(model, model_id)
|
15 |
# else:
|
16 |
+
auth_token = os.environ.get("hub_token") or True
|
17 |
+
|
18 |
+
model = transformers.AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True,use_auth_token=auth_token)
|
19 |
tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2")
|
20 |
|
21 |
def generate_text(prompt):
|