Update handler.py
Browse files- handler.py +4 -2
handler.py
CHANGED
|
@@ -17,6 +17,8 @@ from transformers.utils import logging
|
|
| 17 |
logger = logging.get_logger(__name__)
|
| 18 |
logging.set_verbosity_info()
|
| 19 |
|
|
|
|
|
|
|
| 20 |
DEFAULT_PROMPT = (
|
| 21 |
"Here is a picture showing some food waste.\n\n"
|
| 22 |
"Task: Provide a list of the food waste items visible in the picture.\n"
|
|
@@ -254,13 +256,13 @@ class EndpointHandler:
|
|
| 254 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 255 |
logger.info("Initializing EndpointHandler on device: %s", self.device)
|
| 256 |
self.processor = AutoProcessor.from_pretrained(
|
| 257 |
-
|
| 258 |
trust_remote_code=True,
|
| 259 |
)
|
| 260 |
|
| 261 |
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
| 262 |
self.model = LlavaForConditionalGeneration.from_pretrained(
|
| 263 |
-
|
| 264 |
torch_dtype=dtype,
|
| 265 |
low_cpu_mem_usage=True,
|
| 266 |
device_map={"": self.device},
|
|
|
|
| 17 |
logger = logging.get_logger(__name__)
|
| 18 |
logging.set_verbosity_info()
|
| 19 |
|
| 20 |
+
BASE_MODEL_ID = "mistral-community/pixtral-12b"
|
| 21 |
+
|
| 22 |
DEFAULT_PROMPT = (
|
| 23 |
"Here is a picture showing some food waste.\n\n"
|
| 24 |
"Task: Provide a list of the food waste items visible in the picture.\n"
|
|
|
|
| 256 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 257 |
logger.info("Initializing EndpointHandler on device: %s", self.device)
|
| 258 |
self.processor = AutoProcessor.from_pretrained(
|
| 259 |
+
BASE_MODEL_ID,
|
| 260 |
trust_remote_code=True,
|
| 261 |
)
|
| 262 |
|
| 263 |
dtype = torch.bfloat16 if torch.cuda.is_available() else torch.float32
|
| 264 |
self.model = LlavaForConditionalGeneration.from_pretrained(
|
| 265 |
+
BASE_MODEL_ID,
|
| 266 |
torch_dtype=dtype,
|
| 267 |
low_cpu_mem_usage=True,
|
| 268 |
device_map={"": self.device},
|