Skip to content

Commit f4ca080

Browse files
committed
feat: implement ship model endpoint
1 parent d73ae2b commit f4ca080

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

lib/osml/model_endpoint/me_test_endpoints.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ export class METestEndpointsConfig extends BaseConfig {
7373
*/
7474
public DEPLOY_SM_FLOOD_ENDPOINT: boolean;
7575

76+
/**
77+
* Whether to deploy the SageMaker ship model endpoint.
78+
* @default true
79+
*/
80+
public DEPLOY_SM_SHIP_ENDPOINT: boolean;
81+
7682
/**
7783
* Whether to deploy the SageMaker multi-container model endpoint.
7884
* @default true
@@ -162,6 +168,12 @@ export class METestEndpointsConfig extends BaseConfig {
162168
*/
163169
public SM_FLOOD_MODEL: string;
164170

171+
/**
172+
* The name of the SageMaker endpoint for the flood model.
173+
* @default "ship"
174+
*/
175+
public SM_SHIP_MODEL: string;
176+
165177
/**
166178
* The SageMaker GPU instance type.
167179
*/
@@ -188,6 +200,7 @@ export class METestEndpointsConfig extends BaseConfig {
188200
DEPLOY_SM_AIRCRAFT_ENDPOINT: true,
189201
DEPLOY_SM_CENTERPOINT_ENDPOINT: true,
190202
DEPLOY_SM_FLOOD_ENDPOINT: true,
203+
DEPLOY_SM_SHIP_ENDPOINT: false,
191204
DEPLOY_MULTI_CONTAINER_ENDPOINT: true,
192205
HTTP_ENDPOINT_CPU: 4096,
193206
HTTP_ENDPOINT_CONTAINER_PORT: 8080,
@@ -199,6 +212,7 @@ export class METestEndpointsConfig extends BaseConfig {
199212
SM_AIRCRAFT_MODEL: "aircraft",
200213
SM_CENTER_POINT_MODEL: "centerpoint",
201214
SM_FLOOD_MODEL: "flood",
215+
SM_SHIP_MODEL: "ship",
202216
SM_MULTI_CONTAINER_ENDPOINT: "multi-container",
203217
SM_CPU_INSTANCE_TYPE: "ml.m5.xlarge",
204218
...config
@@ -494,6 +508,60 @@ export class METestEndpoints extends Construct {
494508
this.aircraftModelEndpoint.node.addDependency(this.modelContainer);
495509
}
496510

511+
// Build an SM endpoint for the aircraft model
512+
if (this.config.DEPLOY_SM_AIRCRAFT_ENDPOINT) {
513+
this.aircraftModelEndpoint = new MESMEndpoint(
514+
this,
515+
"OSMLAircraftModelEndpoint",
516+
{
517+
containerImageUri: this.modelContainer.containerUri,
518+
modelName: this.config.SM_AIRCRAFT_MODEL,
519+
roleArn: this.smRole.roleArn,
520+
instanceType:
521+
this.config.SM_GPU_INSTANCE_TYPE ??
522+
regionConfig.sageMakerGpuEndpointInstanceType,
523+
subnetIds: props.osmlVpc.selectedSubnets.subnetIds,
524+
config: [
525+
new MESMEndpointConfig({
526+
CONTAINER_ENV: {
527+
ENABLE_SEGMENTATION: "true",
528+
MODEL_SELECTION: this.config.SM_AIRCRAFT_MODEL
529+
},
530+
SECURITY_GROUP_ID: this.securityGroupId,
531+
REPOSITORY_ACCESS_MODE: this.modelContainer.repositoryAccessMode
532+
})
533+
]
534+
}
535+
);
536+
this.aircraftModelEndpoint.node.addDependency(this.modelContainer);
537+
}
538+
539+
if (this.config.DEPLOY_SM_SHIP_ENDPOINT) {
540+
this.aircraftModelEndpoint = new MESMEndpoint(
541+
this,
542+
"OSMLAircraftModelEndpoint",
543+
{
544+
containerImageUri: this.modelContainer.containerUri,
545+
modelName: this.config.SM_SHIP_MODEL,
546+
roleArn: this.smRole.roleArn,
547+
instanceType:
548+
this.config.SM_GPU_INSTANCE_TYPE ??
549+
regionConfig.sageMakerGpuEndpointInstanceType,
550+
subnetIds: props.osmlVpc.selectedSubnets.subnetIds,
551+
config: [
552+
new MESMEndpointConfig({
553+
CONTAINER_ENV: {
554+
MODEL_SELECTION: this.config.SM_SHIP_MODEL
555+
},
556+
SECURITY_GROUP_ID: this.securityGroupId,
557+
REPOSITORY_ACCESS_MODE: this.modelContainer.repositoryAccessMode
558+
})
559+
]
560+
}
561+
);
562+
this.aircraftModelEndpoint.node.addDependency(this.modelContainer);
563+
}
564+
497565
// Build a multi-container endpoint
498566
if (this.config.DEPLOY_MULTI_CONTAINER_ENDPOINT) {
499567
this.multiContainerModelEndpoint = new MESMEndpoint(

0 commit comments

Comments
 (0)