Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review comments for shape info and readme
  • Loading branch information
VipulMascarenhas committed Feb 2, 2024
commit 61a1b5351dc1a39b7de70b54fc928801f8867331
36 changes: 22 additions & 14 deletions ads/aqua/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
logger = logging.getLogger(__name__)


@dataclass
class ShapeInfo:
instance_shape: str
ocpus: float
memory_in_gbs: float


@dataclass(repr=False)
class AquaDeployment(DataClassSerializable):
"""Represents an Aqua Model Deployment"""
Expand All @@ -37,10 +44,8 @@ class AquaDeployment(DataClassSerializable):
created_on: str
created_by: str
endpoint: str
instance_shape: str
ocpus: float
memory_in_gbs: float
console_link: str
shape_info: ShapeInfo


class AquaDeploymentApp(AquaApp):
Expand Down Expand Up @@ -287,17 +292,7 @@ def from_oci_model_deployment(
instance_shape_config_details = (
instance_configuration.model_deployment_instance_shape_config_details
)
return AquaDeployment(
id=oci_model_deployment.id,
display_name=oci_model_deployment.display_name,
aqua_service_model=oci_model_deployment.freeform_tags.get(
AQUA_SERVICE_MODEL
),
state=oci_model_deployment.lifecycle_state,
description=oci_model_deployment.description,
created_on=str(oci_model_deployment.time_created),
created_by=oci_model_deployment.created_by,
endpoint=oci_model_deployment.model_deployment_url,
shape_info = ShapeInfo(
instance_shape=instance_configuration.instance_shape_name,
ocpus=(
instance_shape_config_details.ocpus
Expand All @@ -309,6 +304,19 @@ def from_oci_model_deployment(
if instance_shape_config_details
else None
),
)
return AquaDeployment(
id=oci_model_deployment.id,
display_name=oci_model_deployment.display_name,
aqua_service_model=oci_model_deployment.freeform_tags.get(
Copy link
Member

Choose a reason for hiding this comment

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

This should be boolean? aqua_service_model=oci_model_deployment.freeform_tags.get(AQUA_SERVICE_MODEL) is not None

Copy link
Member Author

Choose a reason for hiding this comment

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

we're currently treating aqua_service_model as a string field (something like key=aqua_service_model val=llama2), which is also passed along when deployment is created. This is due to an absence of a tag field in AquaModelSummary. Would it be better to treat this as boolean and have something like tags: Dict[str, str] in the dataclass?

AQUA_SERVICE_MODEL
),
shape_info=shape_info,
state=oci_model_deployment.lifecycle_state,
description=oci_model_deployment.description,
created_on=str(oci_model_deployment.time_created),
created_by=oci_model_deployment.created_by,
endpoint=oci_model_deployment.model_deployment_url,
console_link=get_console_link(
resource="model-deployments",
ocid=oci_model_deployment.id,
Expand Down
2 changes: 1 addition & 1 deletion ads/aqua/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _get_artifact_path(self, custom_metadata_list: List) -> str:

def _read_file(self, file_path: str) -> str:
try:
with fsspec.open(file_path, "rb", **self._auth) as f:
with fsspec.open(file_path, "r", **self._auth) as f:
return f.read()
except Exception as e:
logger.error(f"Failed to retreive model icon. {e}")
Expand Down