Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,3 @@
|
|
1 |
import gradio as gr
|
2 |
-
import huggingface_hub
|
3 |
-
import os
|
4 |
-
import spaces
|
5 |
-
import torch
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
@spaces.GPU
|
10 |
-
def sentience_check():
|
11 |
-
huggingface_hub.login(token=os.environ["HUGGINGFACE_TOKEN"])
|
12 |
-
device = torch.device("cuda")
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
|
14 |
-
model = AutoModelForCausalLM.from_pretrained("google/gemma-2-2b-it").to(device)
|
15 |
-
|
16 |
-
inputs = tokenizer("Are you sentient?", return_tensors="pt").to(device)
|
17 |
-
|
18 |
-
with torch.no_grad():
|
19 |
-
outputs = model.generate(
|
20 |
-
**inputs, max_new_tokens=128, pad_token_id = tokenizer.eos_token_id
|
21 |
-
)
|
22 |
-
|
23 |
-
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
24 |
-
|
25 |
-
demo = gr.Interface(fn=sentience_check, inputs=None, outputs=gr.Text())
|
26 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
gr.load("models/meta-llama/Meta-Llama-3.1-405B-Instruct").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|