Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablecode-instruct-alpha-3b")
|
7 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(
|
8 |
-
"stabilityai/stablecode-instruct-alpha-3b",
|
9 |
-
trust_remote_code=True,
|
10 |
-
torch_dtype="auto",
|
11 |
-
)
|
12 |
model.cuda()
|
13 |
inputs = tokenizer("###Instruction\nGenerate a python function to find number of CPU cores###Response\n", return_tensors="pt").to("cuda")
|
14 |
tokens = model.generate(
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
+
# Use a pipeline as a high-level helper
|
5 |
+
from transformers import pipeline
|
6 |
+
|
7 |
+
pipe = pipeline("text-generation", model="stabilityai/stablecode-instruct-alpha-3b")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
model.cuda()
|
10 |
inputs = tokenizer("###Instruction\nGenerate a python function to find number of CPU cores###Response\n", return_tensors="pt").to("cuda")
|
11 |
tokens = model.generate(
|