Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from typing import Iterator
|
|
5 |
import gradio as gr
|
6 |
import spaces
|
7 |
import torch
|
8 |
-
from transformers import AutoModelForCausalLM,
|
9 |
|
10 |
DESCRIPTION = """\
|
11 |
# Gemma 2 9B IT
|
@@ -24,7 +24,7 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
24 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
25 |
|
26 |
model_id = "google/gemma-2-9b-it"
|
27 |
-
tokenizer =
|
28 |
model = AutoModelForCausalLM.from_pretrained(
|
29 |
model_id,
|
30 |
device_map="auto",
|
|
|
5 |
import gradio as gr
|
6 |
import spaces
|
7 |
import torch
|
8 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
|
10 |
DESCRIPTION = """\
|
11 |
# Gemma 2 9B IT
|
|
|
24 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
25 |
|
26 |
model_id = "google/gemma-2-9b-it"
|
27 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
28 |
model = AutoModelForCausalLM.from_pretrained(
|
29 |
model_id,
|
30 |
device_map="auto",
|