Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sagemaker-serve/src/sagemaker/serve/model_builder_servers.py
Comment thread
aviruthen marked this conversation as resolved.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, only one more failed unit test! Can you resolve this error too? The sagemaker-core failed integ tests are again unrelated!

FAILED tests/unit/test_model_builder_servers_hf_model_id.py::TestBuildForTransformersHfModelId::test_preserves_with_inference_spec - FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test_model_path/code/serve.pkl'

Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _build_for_torchserve(self) -> Model:
if isinstance(self.model, str):
# Configure HuggingFace model support
if not self._is_jumpstart_model_id():
self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)
Comment thread
aviruthen marked this conversation as resolved.

# Add HuggingFace token if available
if self.env_vars.get("HUGGING_FACE_HUB_TOKEN"):
Expand Down Expand Up @@ -212,7 +212,7 @@ def _build_for_tgi(self) -> Model:

if isinstance(self.model, str) and not self._is_jumpstart_model_id():
# Configure HuggingFace model for TGI
self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)

self.hf_model_config = _get_model_config_properties_from_hf(
self.model, self.env_vars.get("HUGGING_FACE_HUB_TOKEN")
Expand Down Expand Up @@ -320,7 +320,7 @@ def _build_for_djl(self) -> Model:

if isinstance(self.model, str) and not self._is_jumpstart_model_id():
# Configure HuggingFace model for DJL
self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)

# Get model configuration for DJL optimization
self.hf_model_config = _get_model_config_properties_from_hf(
Expand Down Expand Up @@ -426,7 +426,7 @@ def _build_for_triton(self) -> Model:
self.env_vars.update({"HF_TASK": model_task})

# Configure HuggingFace authentication
self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)
if self.env_vars.get("HUGGING_FACE_HUB_TOKEN"):
self.env_vars["HF_TOKEN"] = self.env_vars.get("HUGGING_FACE_HUB_TOKEN")

Expand Down Expand Up @@ -532,7 +532,7 @@ def _build_for_tei(self) -> Model:

if isinstance(self.model, str) and not self._is_jumpstart_model_id():
# Configure HuggingFace model for TEI
self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)

self.hf_model_config = _get_model_config_properties_from_hf(
self.model, self.env_vars.get("HUGGING_FACE_HUB_TOKEN")
Expand Down Expand Up @@ -676,7 +676,7 @@ def _build_for_transformers(self) -> Model:
if self.inference_spec is not None:
hf_model_id = self.inference_spec.get_model()
if isinstance(hf_model_id, str): # Only if it's a valid HF model ID
self.env_vars.update({"HF_MODEL_ID": hf_model_id})
self.env_vars.setdefault("HF_MODEL_ID", hf_model_id)
# Get HF config only for string model IDs
if hasattr(self.env_vars, "HF_API_TOKEN"):
self.hf_model_config = _get_model_config_properties_from_hf(
Expand All @@ -695,7 +695,7 @@ def _build_for_transformers(self) -> Model:
if model_task:
self.env_vars.update({"HF_TASK": model_task})

self.env_vars.update({"HF_MODEL_ID": self.model})
self.env_vars.setdefault("HF_MODEL_ID", self.model)

# Add HuggingFace token if available
if self.env_vars.get("HUGGING_FACE_HUB_TOKEN"):
Expand Down
Loading
Loading