Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import torch
|
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
#model = AutoModelForCausalLM.from_pretrained("cyberagent/open-calm-3b", device_map="auto", torch_dtype=torch.int8, load_in_8bit=True)
|
7 |
-
model = AutoModelForCausalLM.from_pretrained("cyberagent/open-calm-3b", device_map="auto", torch_dtype=torch.float16)
|
8 |
tokenizer = AutoTokenizer.from_pretrained("cyberagent/open-calm-3b")
|
9 |
|
10 |
def proc( inputs ):
|
@@ -21,8 +21,9 @@ def proc( inputs ):
|
|
21 |
|
22 |
def greet(name):
|
23 |
inputs = tokenizer(name, return_tensors="pt").to(model.device)
|
24 |
-
outputs = proc( inputs )
|
25 |
-
return( outputs )
|
|
|
26 |
|
27 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
28 |
iface.launch()
|
|
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
#model = AutoModelForCausalLM.from_pretrained("cyberagent/open-calm-3b", device_map="auto", torch_dtype=torch.int8, load_in_8bit=True)
|
7 |
+
#model = AutoModelForCausalLM.from_pretrained("cyberagent/open-calm-3b", device_map="auto", torch_dtype=torch.float16)
|
8 |
tokenizer = AutoTokenizer.from_pretrained("cyberagent/open-calm-3b")
|
9 |
|
10 |
def proc( inputs ):
|
|
|
21 |
|
22 |
def greet(name):
|
23 |
inputs = tokenizer(name, return_tensors="pt").to(model.device)
|
24 |
+
#outputs = proc( inputs )
|
25 |
+
#return( outputs )
|
26 |
+
return inputs
|
27 |
|
28 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
29 |
iface.launch()
|