Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import torch
|
|
| 4 |
from PIL import Image
|
| 5 |
from pathlib import Path
|
| 6 |
from threading import Thread
|
| 7 |
-
from transformers import AutoProcessor, Gemma3ForConditionalGeneration, TextIteratorStreamer
|
| 8 |
import spaces
|
| 9 |
import time
|
| 10 |
|
|
@@ -15,11 +15,15 @@ DESCRIPTION= """
|
|
| 15 |
|
| 16 |
# model config
|
| 17 |
model_270m_name = "google/gemma-3-270m-it"
|
| 18 |
-
model_270m =
|
| 19 |
model_270m_name,
|
|
|
|
| 20 |
device_map="auto",
|
| 21 |
-
|
| 22 |
).eval()
|
|
|
|
|
|
|
|
|
|
| 23 |
processor_4b = AutoProcessor.from_pretrained(model_270m_name)
|
| 24 |
# I will add timestamp later
|
| 25 |
def extract_video_frames(video_path, num_frames=8):
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
from pathlib import Path
|
| 6 |
from threading import Thread
|
| 7 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoProcessor, Gemma3ForConditionalGeneration, TextIteratorStreamer
|
| 8 |
import spaces
|
| 9 |
import time
|
| 10 |
|
|
|
|
| 15 |
|
| 16 |
# model config
|
| 17 |
model_270m_name = "google/gemma-3-270m-it"
|
| 18 |
+
model_270m = AutoModelForCausalLM.from_pretrained(
|
| 19 |
model_270m_name,
|
| 20 |
+
torch_dtype="auto",
|
| 21 |
device_map="auto",
|
| 22 |
+
attn_implementation="eager"
|
| 23 |
).eval()
|
| 24 |
+
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_270m)
|
| 26 |
+
|
| 27 |
processor_4b = AutoProcessor.from_pretrained(model_270m_name)
|
| 28 |
# I will add timestamp later
|
| 29 |
def extract_video_frames(video_path, num_frames=8):
|