Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
|
@@ -14,7 +14,8 @@ run("pip install torch torchvision torchaudio --extra-index-url https://download
|
|
| 14 |
|
| 15 |
from transformers import AutoModelForVision2Seq, AutoProcessor, BitsAndBytesConfig
|
| 16 |
|
| 17 |
-
model_id = "ibm-granite/granite-vision-3.2-2b"
|
|
|
|
| 18 |
|
| 19 |
bnb_config = BitsAndBytesConfig(
|
| 20 |
load_in_4bit=True,
|
|
@@ -71,7 +72,7 @@ class EndpointHandler():
|
|
| 71 |
def __init__(self, path=""):
|
| 72 |
self.model=AutoModelForVision2Seq.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16,
|
| 73 |
quantization_config=bnb_config)
|
| 74 |
-
self.model.load_adapter("Portx/granite-vision-3.2-2b-20252802")
|
| 75 |
self.processor = AutoProcessor.from_pretrained(model_id, use_fast=True)
|
| 76 |
|
| 77 |
def __call__(self, data):
|
|
|
|
| 14 |
|
| 15 |
from transformers import AutoModelForVision2Seq, AutoProcessor, BitsAndBytesConfig
|
| 16 |
|
| 17 |
+
#model_id = "ibm-granite/granite-vision-3.2-2b"
|
| 18 |
+
model_id = "Portx/granite-vision-3.1-2b-preview-do-extractor"
|
| 19 |
|
| 20 |
bnb_config = BitsAndBytesConfig(
|
| 21 |
load_in_4bit=True,
|
|
|
|
| 72 |
def __init__(self, path=""):
|
| 73 |
self.model=AutoModelForVision2Seq.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16,
|
| 74 |
quantization_config=bnb_config)
|
| 75 |
+
#self.model.load_adapter("Portx/granite-vision-3.2-2b-20252802")
|
| 76 |
self.processor = AutoProcessor.from_pretrained(model_id, use_fast=True)
|
| 77 |
|
| 78 |
def __call__(self, data):
|