Skip to content

Commit

Permalink
[SageMaker Galactus developer experience] use python backend when sch…
Browse files Browse the repository at this point in the history
…ema is customized
  • Loading branch information
wayneyao committed Nov 7, 2023
1 parent 407aea4 commit 5221daf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions wlm/src/main/java/ai/djl/serving/wlm/SageMakerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public final class SageMakerUtils {
private static final String TASK = "Task";
private static final String VERSION = "Version";
private static final String XGBOOST_MODEL_TYPE = "XGBoostModel";
private static final String YAML_FORMAT = ".yaml";

private SageMakerUtils() {}

Expand Down Expand Up @@ -110,8 +109,7 @@ private static boolean validateMetaData(Map<String, Object> metaDataMap) {

private static boolean hasCustomizedSchema(Map<String, Object> metaDataMap)
throws ModelException {
if (metaDataMap.containsKey(SCHEMA)
&& !metaDataMap.get(SCHEMA).toString().contains(YAML_FORMAT)) {
if (metaDataMap.containsKey(SCHEMA)) {
if (!metaDataMap.containsKey(SCHEMA_HMAC)) {
throw new ModelException(
"Invalid SageMaker Model format due to SchemaHMAC is not found");
Expand Down
3 changes: 2 additions & 1 deletion wlm/src/test/java/ai/djl/serving/wlm/ModelInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ public void testInferLMIEngine() throws IOException, ModelException {
public void testInferSageMakerEngine() throws IOException, ModelException {
ModelInfo<Input, Output> model = new ModelInfo<>("src/test/resources/sagemaker/xgb_model");
model.initialize();
assertEquals(model.getEngineName(), "XGBoost");
assertEquals(model.getEngineName(), "Python");
assertEquals(model.prop.getProperty("option.entryPoint"), "djl_python.sagemaker");

// test case for valid pytorch model with customized schema and inference spec
model = new ModelInfo<>("src/test/resources/sagemaker/pytorch_model");
Expand Down

0 comments on commit 5221daf

Please sign in to comment.