|
16 | 16 | from typing import Type
|
17 | 17 | from abc import ABC, abstractmethod
|
18 | 18 |
|
| 19 | +from sagemaker import image_uris |
19 | 20 | from sagemaker.model import Model
|
20 | 21 | from sagemaker.djl_inference.model import _get_model_config_properties_from_hf
|
21 | 22 |
|
22 |
| -from sagemaker.huggingface import HuggingFaceModel, get_huggingface_llm_image_uri |
| 23 | +from sagemaker.huggingface import HuggingFaceModel |
23 | 24 | from sagemaker.serve.utils.local_hardware import (
|
24 | 25 | _get_nb_instance,
|
25 | 26 | )
|
@@ -84,11 +85,16 @@ def _set_to_tgi(self):
|
84 | 85 | logger.warning(messaging)
|
85 | 86 | self.model_server = ModelServer.TGI
|
86 | 87 |
|
87 |
| - def _create_tei_model(self) -> Type[Model]: |
| 88 | + def _create_tei_model(self, **kwargs) -> Type[Model]: |
88 | 89 | """Placeholder docstring"""
|
| 90 | + if self.nb_instance_type and "instance_type" not in kwargs: |
| 91 | + kwargs.update({"instance_type": self.nb_instance_type}) |
| 92 | + |
89 | 93 | if not self.image_uri:
|
90 |
| - self.image_uri = get_huggingface_llm_image_uri( |
91 |
| - "huggingface-tei", session=self.sagemaker_session |
| 94 | + self.image_uri = image_uris.retrieve( |
| 95 | + "huggingface-tei", |
| 96 | + image_scope="inference", |
| 97 | + instance_type=kwargs.get("instance_type") |
92 | 98 | )
|
93 | 99 |
|
94 | 100 | pysdk_model = HuggingFaceModel(
|
@@ -164,9 +170,7 @@ def _tei_model_builder_deploy_wrapper(self, *args, **kwargs) -> Type[PredictorBa
|
164 | 170 | if "endpoint_logging" not in kwargs:
|
165 | 171 | kwargs["endpoint_logging"] = True
|
166 | 172 |
|
167 |
| - if self.nb_instance_type and "instance_type" not in kwargs: |
168 |
| - kwargs.update({"instance_type": self.nb_instance_type}) |
169 |
| - elif not self.nb_instance_type and "instance_type" not in kwargs: |
| 173 | + if not self.nb_instance_type and "instance_type" not in kwargs: |
170 | 174 | raise ValueError(
|
171 | 175 | "Instance type must be provided when deploying " "to SageMaker Endpoint mode."
|
172 | 176 | )
|
|
0 commit comments