diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/HuggingFaceModelSpec.java b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/HuggingFaceModelSpec.java deleted file mode 100644 index be2658a0..00000000 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/HuggingFaceModelSpec.java +++ /dev/null @@ -1,11 +0,0 @@ - -package it.smartcommunitylabdhub.core.models.specs.model; - - -import it.smartcommunitylabdhub.commons.annotations.common.SpecType; -import it.smartcommunitylabdhub.commons.models.entities.EntityName; - - -@SpecType(kind = "huggingface", entity = EntityName.MODEL) -public class HuggingFaceModelSpec extends it.smartcommunitylabdhub.commons.models.model.HuggingFaceModelSpec { -} diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/MlflowModelSpec.java b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/MlflowModelSpec.java deleted file mode 100644 index 92a16845..00000000 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/MlflowModelSpec.java +++ /dev/null @@ -1,9 +0,0 @@ -package it.smartcommunitylabdhub.core.models.specs.model; - - -import it.smartcommunitylabdhub.commons.annotations.common.SpecType; -import it.smartcommunitylabdhub.commons.models.entities.EntityName; -@SpecType(kind = "mlflow", entity = EntityName.MODEL) -public class MlflowModelSpec extends it.smartcommunitylabdhub.commons.models.model.MlflowModelSpec { - -} \ No newline at end of file diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/ModelSpec.java b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/ModelSpec.java index cdf1ed5f..424661d8 100644 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/ModelSpec.java +++ b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/ModelSpec.java @@ -2,6 +2,6 @@ import it.smartcommunitylabdhub.commons.annotations.common.SpecType; import it.smartcommunitylabdhub.commons.models.entities.EntityName; + @SpecType(kind = "model", entity = EntityName.MODEL) -public class ModelSpec extends it.smartcommunitylabdhub.commons.models.model.ModelBaseSpec { -} +public class ModelSpec extends it.smartcommunitylabdhub.commons.models.model.ModelBaseSpec {} diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Dataset.java b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Dataset.java deleted file mode 100644 index addd12cb..00000000 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Dataset.java +++ /dev/null @@ -1,18 +0,0 @@ -package it.smartcommunitylabdhub.core.models.specs.model.mlflow; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class Dataset { - - private String name; - private String digest; - private String profile; - private String schema; - private String source; - @JsonProperty("source_type") - private String sourceType; -} \ No newline at end of file diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Signature.java b/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Signature.java deleted file mode 100644 index 9575227a..00000000 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/mlflow/Signature.java +++ /dev/null @@ -1,13 +0,0 @@ -package it.smartcommunitylabdhub.core.models.specs.model.mlflow; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class Signature { - - private String inputs; - private String outputs; - private String params; -} \ No newline at end of file diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/annotations/common/SpecType.java b/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/annotations/common/SpecType.java index 95e7bf36..489ab17c 100644 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/annotations/common/SpecType.java +++ b/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/annotations/common/SpecType.java @@ -1,13 +1,12 @@ package it.smartcommunitylabdhub.commons.annotations.common; +import it.smartcommunitylabdhub.commons.models.entities.EntityName; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.stereotype.Indexed; -import it.smartcommunitylabdhub.commons.models.entities.EntityName; - @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Indexed diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/SKLearnModelSpec.java b/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/SKLearnModelSpec.java deleted file mode 100644 index 26b3fa25..00000000 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/SKLearnModelSpec.java +++ /dev/null @@ -1,10 +0,0 @@ -package it.smartcommunitylabdhub.commons.models.model; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class SKLearnModelSpec extends ModelSpec { - -} \ No newline at end of file diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Dataset.java b/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Dataset.java deleted file mode 100644 index 74d123bb..00000000 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Dataset.java +++ /dev/null @@ -1,26 +0,0 @@ -package it.smartcommunitylabdhub.commons.models.model.mlflow; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class Dataset { - - @Schema(title = "fields.mlflow.inputdatasetname.title", description = "fields.mlflow.inputdatasetname.description") - private String name; - @Schema(title = "fields.mlflow.inputdatasetdigest.title", description = "fields.mlflow.inputdatasetdigest.description") - private String digest; - @Schema(title = "fields.mlflow.inputdatasetprofile.title", description = "fields.mlflow.inputdatasetprofile.description") - private String profile; - @Schema(title = "fields.mlflow.inputdatasetschema.title", description = "fields.mlflow.inputdatasetschema.description") - private String schema; - @Schema(title = "fields.mlflow.inputdatasetsource.title", description = "fields.mlflow.inputdatasetsource.description") - private String source; - @JsonProperty("source_type") - @Schema(title = "fields.mlflow.inputdatasetsourcetype.title", description = "fields.mlflow.inputdatasetsourcetype.description") - private String sourceType; -} \ No newline at end of file diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/HuggingFaceModelSpec.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingFaceModelSpec.java similarity index 65% rename from modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/HuggingFaceModelSpec.java rename to modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingFaceModelSpec.java index 733a1c78..a0634ddc 100644 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/HuggingFaceModelSpec.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/huggingface/specs/HuggingFaceModelSpec.java @@ -1,17 +1,18 @@ -package it.smartcommunitylabdhub.commons.models.model; - -import lombok.Getter; -import lombok.Setter; - -import java.io.Serializable; -import java.util.Map; +package it.smartcommunitylabdhub.runtime.huggingface.specs; import com.fasterxml.jackson.annotation.JsonProperty; - import io.swagger.v3.oas.annotations.media.Schema; +import it.smartcommunitylabdhub.commons.annotations.common.SpecType; +import it.smartcommunitylabdhub.commons.models.entities.EntityName; +import it.smartcommunitylabdhub.commons.models.model.ModelSpec; +import java.io.Serializable; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; @Getter @Setter +@SpecType(kind = "huggingface", entity = EntityName.MODEL) public class HuggingFaceModelSpec extends ModelSpec { //Huggingface model id @@ -21,7 +22,10 @@ public class HuggingFaceModelSpec extends ModelSpec { //Huggingface model revision @JsonProperty("model_revision") - @Schema(title = "fields.huggingface.modelrevision.title", description = "fields.huggingface.modelrevision.description") + @Schema( + title = "fields.huggingface.modelrevision.title", + description = "fields.huggingface.modelrevision.description" + ) private String modelRevision; @Override diff --git a/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Dataset.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Dataset.java new file mode 100644 index 00000000..2e2d2925 --- /dev/null +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Dataset.java @@ -0,0 +1,45 @@ +package it.smartcommunitylabdhub.runtime.mlflow.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Dataset { + + @Schema(title = "fields.mlflow.inputdatasetname.title", description = "fields.mlflow.inputdatasetname.description") + private String name; + + @Schema( + title = "fields.mlflow.inputdatasetdigest.title", + description = "fields.mlflow.inputdatasetdigest.description" + ) + private String digest; + + @Schema( + title = "fields.mlflow.inputdatasetprofile.title", + description = "fields.mlflow.inputdatasetprofile.description" + ) + private String profile; + + @Schema( + title = "fields.mlflow.inputdatasetschema.title", + description = "fields.mlflow.inputdatasetschema.description" + ) + private String schema; + + @Schema( + title = "fields.mlflow.inputdatasetsource.title", + description = "fields.mlflow.inputdatasetsource.description" + ) + private String source; + + @JsonProperty("source_type") + @Schema( + title = "fields.mlflow.inputdatasetsourcetype.title", + description = "fields.mlflow.inputdatasetsourcetype.description" + ) + private String sourceType; +} diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Signature.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Signature.java similarity index 90% rename from modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Signature.java rename to modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Signature.java index 6b1514ca..d72a9360 100644 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/mlflow/Signature.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/models/Signature.java @@ -1,4 +1,4 @@ -package it.smartcommunitylabdhub.commons.models.model.mlflow; +package it.smartcommunitylabdhub.runtime.mlflow.models; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; @@ -10,8 +10,10 @@ public class Signature { @Schema(title = "fields.mlflow.signatureinputs.title", description = "fields.mlflow.signatureinputs.description") private String inputs; + @Schema(title = "fields.mlflow.signatureoutputs.title", description = "fields.mlflow.signatureoutputs.description") private String outputs; + @Schema(title = "fields.mlflow.signatureparams.title", description = "fields.mlflow.signatureparams.description") private String params; -} \ No newline at end of file +} diff --git a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/MlflowModelSpec.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/specs/MlflowModelSpec.java similarity index 75% rename from modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/MlflowModelSpec.java rename to modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/specs/MlflowModelSpec.java index 46a2ee94..84408fbb 100644 --- a/modules/commons/src/main/java/it/smartcommunitylabdhub/commons/models/model/MlflowModelSpec.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/mlflow/specs/MlflowModelSpec.java @@ -1,26 +1,26 @@ -package it.smartcommunitylabdhub.commons.models.model; - - -import lombok.Getter; -import lombok.Setter; +package it.smartcommunitylabdhub.runtime.mlflow.specs; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import it.smartcommunitylabdhub.commons.annotations.common.SpecType; +import it.smartcommunitylabdhub.commons.models.entities.EntityName; +import it.smartcommunitylabdhub.commons.models.model.ModelSpec; +import it.smartcommunitylabdhub.runtime.mlflow.models.Dataset; +import it.smartcommunitylabdhub.runtime.mlflow.models.Signature; import java.io.Serializable; import java.util.List; import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import io.swagger.v3.oas.annotations.media.Schema; -import it.smartcommunitylabdhub.commons.models.model.mlflow.Dataset; -import it.smartcommunitylabdhub.commons.models.model.mlflow.Signature; +import lombok.Getter; +import lombok.Setter; @Getter @Setter +@SpecType(kind = "mlflow", entity = EntityName.MODEL) public class MlflowModelSpec extends ModelSpec { @Schema(title = "fields.mlflow.flavor.title", description = "fields.mlflow.flavor.description") private String flavor; - + @JsonProperty("model_config") @Schema(title = "fields.mlflow.modelconfig.title", description = "fields.mlflow.modelconfig.description") private Map modelConfig; @@ -42,4 +42,4 @@ public void configure(Map data) { this.inputDatasets = spec.getInputDatasets(); this.modelConfig = spec.getModelConfig(); } -} \ No newline at end of file +} diff --git a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/SKLearnModelSpec.java b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/sklearn/specs/SKLearnModelSpec.java similarity index 53% rename from application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/SKLearnModelSpec.java rename to modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/sklearn/specs/SKLearnModelSpec.java index d0a3a926..5410dd9d 100644 --- a/application/src/main/java/it/smartcommunitylabdhub/core/models/specs/model/SKLearnModelSpec.java +++ b/modules/runtime-model-serve/src/main/java/it/smartcommunitylabdhub/runtime/sklearn/specs/SKLearnModelSpec.java @@ -1,9 +1,8 @@ -package it.smartcommunitylabdhub.core.models.specs.model; - +package it.smartcommunitylabdhub.runtime.sklearn.specs; import it.smartcommunitylabdhub.commons.annotations.common.SpecType; import it.smartcommunitylabdhub.commons.models.entities.EntityName; +import it.smartcommunitylabdhub.commons.models.model.ModelSpec; @SpecType(kind = "sklearn", entity = EntityName.MODEL) -public class SKLearnModelSpec extends it.smartcommunitylabdhub.commons.models.model.SKLearnModelSpec { -} \ No newline at end of file +public class SKLearnModelSpec extends ModelSpec {}