Spaces:
Runtime error
Runtime error
Yash Sachdeva
commited on
Commit
·
724ddd6
1
Parent(s):
3461642
hello world
Browse files- question_paper.py +15 -15
question_paper.py
CHANGED
@@ -12,22 +12,22 @@ TOKENIZER = None
|
|
12 |
# ?input=%22Name%203%20shows%22
|
13 |
@app.get("/")
|
14 |
def llama(input):
|
15 |
-
prompt = [{'role': 'user', 'content': ""+input}]
|
16 |
-
inputs = TOKENIZER.apply_chat_template( prompt, add_generation_prompt=True, return_tensors='pt' )
|
17 |
|
18 |
-
tokens = MODEL.generate( inputs.to(MODEL.device), max_new_tokens=1024, temperature=0.3, do_sample=True)
|
19 |
|
20 |
-
tresponse = TOKENIZER.decode(tokens[0], skip_special_tokens=False)
|
21 |
-
print(tresponse)
|
22 |
|
23 |
-
return
|
24 |
|
25 |
-
@app.on_event("startup")
|
26 |
-
def init_model():
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
12 |
# ?input=%22Name%203%20shows%22
|
13 |
@app.get("/")
|
14 |
def llama(input):
|
15 |
+
# prompt = [{'role': 'user', 'content': ""+input}]
|
16 |
+
# inputs = TOKENIZER.apply_chat_template( prompt, add_generation_prompt=True, return_tensors='pt' )
|
17 |
|
18 |
+
# tokens = MODEL.generate( inputs.to(MODEL.device), max_new_tokens=1024, temperature=0.3, do_sample=True)
|
19 |
|
20 |
+
# tresponse = TOKENIZER.decode(tokens[0], skip_special_tokens=False)
|
21 |
+
# print(tresponse)
|
22 |
|
23 |
+
return "hello world"
|
24 |
|
25 |
+
# @app.on_event("startup")
|
26 |
+
# def init_model():
|
27 |
+
# global MODEL
|
28 |
+
# global TOKENIZER
|
29 |
+
# if not MODEL:
|
30 |
+
# print("loading model")
|
31 |
+
# TOKENIZER = AutoTokenizer.from_pretrained('stabilityai/stablelm-zephyr-3b')
|
32 |
+
# MODEL = AutoModelForCausalLM.from_pretrained('stabilityai/stablelm-zephyr-3b', device_map="auto")
|
33 |
+
# print("loaded model")
|