VascoBartolo
commited on
Commit
·
6d763f7
1
Parent(s):
52f7b61
fix import for the model-4
Browse files- handler.py +10 -3
handler.py
CHANGED
@@ -1,12 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from typing import Dict, List, Any
|
2 |
import torch
|
3 |
-
from transformers import
|
4 |
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, path=""):
|
7 |
# Load the model and processor
|
8 |
-
self.model =
|
9 |
-
self.processor =
|
10 |
|
11 |
# Ensure the model is in evaluation mode
|
12 |
self.model.eval()
|
|
|
1 |
+
import transformers
|
2 |
+
import logging
|
3 |
+
|
4 |
+
# Print the transformers package version
|
5 |
+
logging.basicConfig(level=logging.INFO)
|
6 |
+
logging.info(f"Transformers version: {transformers.__version__}")
|
7 |
+
|
8 |
from typing import Dict, List, Any
|
9 |
import torch
|
10 |
+
from transformers import LlavaNextVideoForConditionalGeneration, LlavaNextVideoProcessor
|
11 |
|
12 |
class EndpointHandler:
|
13 |
def __init__(self, path=""):
|
14 |
# Load the model and processor
|
15 |
+
self.model = LlavaNextVideoForConditionalGeneration.from_pretrained(path)
|
16 |
+
self.processor = LlavaNextVideoProcessor.from_pretrained(path)
|
17 |
|
18 |
# Ensure the model is in evaluation mode
|
19 |
self.model.eval()
|