Skip to content

[ODSC-72395] Changes to support multiple container versions in AQUA #1208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
31 changes: 23 additions & 8 deletions ads/aqua/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,9 @@ def get_config(

return ModelConfigResult(config=config, model_details=oci_model)

def get_container_image(self, container_type: str = None) -> str:
def get_container_image(
self, container_type: str = None, container_tag: str = None
) -> str:
"""
Gets the latest smc container complete image name from the given container type.

Expand All @@ -463,6 +465,9 @@ def get_container_image(self, container_type: str = None) -> str:
container_type: str
type of container, can be either odsc-vllm-serving, odsc-llm-fine-tuning, odsc-llm-evaluate

container_tag: str
tag of container, ex: 0.8.5.post1.1

Returns
-------
str:
Expand All @@ -476,13 +481,23 @@ def get_container_image(self, container_type: str = None) -> str:
)
if not container:
raise AquaValueError(f"Invalid container type : {container_type}")
container_image = (
SERVICE_MANAGED_CONTAINER_URI_SCHEME
+ container.container_name
+ ":"
+ container.tag
)
return container_image

if container_tag:
container_image = (
SERVICE_MANAGED_CONTAINER_URI_SCHEME
+ container.container_name
+ ":"
+ container_tag
)
return container_image
else:
container_image = (
SERVICE_MANAGED_CONTAINER_URI_SCHEME
+ container.container_name
+ ":"
+ container.tag
)
return container_image

@cached(cache=TTLCache(maxsize=20, ttl=timedelta(minutes=30), timer=datetime.now))
def list_service_containers(self) -> List[ContainerSummary]:
Expand Down
15 changes: 9 additions & 6 deletions ads/aqua/config/container_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class AquaContainerConfig(Serializable):
evaluate (Dict[str, AquaContainerConfigItem]): Evaluation container configuration items.
"""

inference: Dict[str, AquaContainerConfigItem] = Field(
inference: Dict[str, List[AquaContainerConfigItem]] = Field(
Copy link
Member

Choose a reason for hiding this comment

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

this change will break in a few places where AquaContainerConfig is used, likely in deployment.py. Can you check if that class needs changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure , will check , thanks

default_factory=dict, description="Inference container configuration items."
)
finetune: Dict[str, AquaContainerConfigItem] = Field(
Expand All @@ -130,7 +130,9 @@ class AquaContainerConfig(Serializable):

def to_dict(self):
return {
"inference": list(self.inference.values()),
"inference": [
item for sublist in self.inference.values() for item in sublist
],
"finetune": list(self.finetune.values()),
"evaluate": list(self.evaluate.values()),
}
Expand All @@ -149,12 +151,11 @@ def from_service_config(
-------
AquaContainerConfig: The constructed container configuration.
"""

inference_items: Dict[str, AquaContainerConfigItem] = {}
inference_items: Dict[str, List[AquaContainerConfigItem]] = {}
finetune_items: Dict[str, AquaContainerConfigItem] = {}
evaluate_items: Dict[str, AquaContainerConfigItem] = {}
for container in service_containers:
if not container.is_latest:
if "INFERENCE" not in container.usages and not container.is_latest:
continue
container_item = AquaContainerConfigItem(
name=SERVICE_MANAGED_CONTAINER_URI_SCHEME + container.container_name,
Expand Down Expand Up @@ -242,7 +243,9 @@ def from_service_config(
)

if "INFERENCE" in usages or "MULTI_MODEL" in usages:
inference_items[container_type] = container_item
if container_type not in inference_items:
inference_items[container_type] = []
inference_items[container_type].append(container_item)
if "FINE_TUNE" in usages:
finetune_items[container_type] = container_item
if "EVALUATION" in usages:
Expand Down
11 changes: 9 additions & 2 deletions ads/aqua/modeldeployment/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def create(
health_check_port (Optional[int]): Health check port for the Docker container image.
env_var (Optional[Dict[str, str]]): Environment variables for deployment.
container_family (Optional[str]): Image family of the model deployment container runtime.
container_tag (Optional[str]): Image tag of the model deployment container runtime
memory_in_gbs (Optional[float]): Memory (in GB) for the selected shape.
ocpus (Optional[float]): OCPU count for the selected shape.
model_file (Optional[str]): File used for model deployment.
Expand Down Expand Up @@ -425,7 +426,10 @@ def _create(

container_image_uri = (
create_deployment_details.container_image_uri
or self.get_container_image(container_type=container_type_key)
or self.get_container_image(
container_type=container_type_key,
container_tag=create_deployment_details.container_tag,
)
)
if not container_image_uri:
try:
Expand Down Expand Up @@ -631,7 +635,10 @@ def _create_multi(

container_image_uri = (
create_deployment_details.container_image_uri
or self.get_container_image(container_type=container_type_key)
or self.get_container_image(
container_type=container_type_key,
container_tag=create_deployment_details.container_tag,
)
)
server_port = create_deployment_details.server_port or (
container_spec.server_port if container_spec else None
Expand Down
3 changes: 3 additions & 0 deletions ads/aqua/modeldeployment/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ class CreateModelDeploymentDetails(BaseModel):
container_family: Optional[str] = Field(
None, description="Image family of the model deployment container runtime."
)
container_tag: Optional[str] = Field(
None, description="Image tag of the model deployment container runtime."
)
memory_in_gbs: Optional[float] = Field(
None, description="Memory (in GB) for the selected shape."
)
Expand Down
Loading