Package ai.djl.repository
Class MRL
- java.lang.Object
-
- ai.djl.repository.MRL
-
public final class MRL extends java.lang.ObjectTheMRL(Machine learning Resource Locator) is a pointer to aMetadata"resource" on a machine learningRepository.Each mrl references a single metadata file (parsed to
Metadataand the collection of artifacts located within it. Those artifacts all share the same groupId and artifactId, but can differ based on the name and properties.The mrl consists of three different properties:
- type - The resource type, e.g. model or dataset.
- application - The resource application (See
Application). - groupId - The group id identifies the group publishing the artifacts using a reverse domain name system.
- artifactId - The artifact id identifies the different artifacts published by a single group.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MRLdataset(Repository repository, Application application, java.lang.String groupId, java.lang.String artifactId, java.lang.String version)Creates a datasetMRLwith specified application.ApplicationgetApplication()Returns the application.java.lang.StringgetArtifactId()Returns the artifactId.ArtifactgetDefaultArtifact()Returns the default artifact.java.lang.StringgetGroupId()Returns the groupId.RepositorygetRepository()Returns the repository.java.lang.StringgetVersion()Returns the version.java.util.List<Artifact>listArtifacts()Returns a list of artifacts in this resource.Artifactmatch(java.util.Map<java.lang.String,java.lang.String> criteria)Returns the first artifact that matches a given criteria.static MRLmodel(Repository repository, Application application, java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String artifactName)Creates a modelMRLwith specified application.voidprepare(Artifact artifact)Prepares the artifact for use.voidprepare(Artifact artifact, ai.djl.util.Progress progress)Prepares the artifact for use with progress tracking.java.lang.StringtoString()java.net.URItoURI()Returns the URI to the metadata location (used forRepositoryimplementations).static MRLundefined(Repository repository, java.lang.String groupId, java.lang.String artifactId)Creates a datasetMRLwith specified application.
-
-
-
Method Detail
-
model
public static MRL model(Repository repository, Application application, java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String artifactName)
Creates a modelMRLwith specified application.- Parameters:
repository- theRepositoryapplication- the desired applicationgroupId- the desired groupIdartifactId- the desired artifactIdversion- the resource versionartifactName- the desired artifact name- Returns:
- a model
MRL
-
dataset
public static MRL dataset(Repository repository, Application application, java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
Creates a datasetMRLwith specified application.- Parameters:
repository- theRepositoryapplication- the desired applicationgroupId- the desired groupIdartifactId- the desired artifactIdversion- the resource version- Returns:
- a dataset
MRL
-
undefined
public static MRL undefined(Repository repository, java.lang.String groupId, java.lang.String artifactId)
Creates a datasetMRLwith specified application.- Parameters:
repository- theRepositorygroupId- the desired groupIdartifactId- the desired artifactId- Returns:
- a dataset
MRL
-
toURI
public java.net.URI toURI()
Returns the URI to the metadata location (used forRepositoryimplementations).- Returns:
- the URI to the metadata location
-
getRepository
public Repository getRepository()
Returns the repository.- Returns:
- the repository
-
getApplication
public Application getApplication()
Returns the application.- Returns:
- the application
-
getGroupId
public java.lang.String getGroupId()
Returns the groupId.- Returns:
- the groupId
-
getArtifactId
public java.lang.String getArtifactId()
Returns the artifactId.- Returns:
- the artifactId
-
getVersion
public java.lang.String getVersion()
Returns the version.- Returns:
- the version
-
getDefaultArtifact
public Artifact getDefaultArtifact() throws java.io.IOException
Returns the default artifact.- Returns:
- the default artifact
- Throws:
java.io.IOException- for various exceptions depending on the specific dataset
-
match
public Artifact match(java.util.Map<java.lang.String,java.lang.String> criteria) throws java.io.IOException
Returns the first artifact that matches a given criteria.- Parameters:
criteria- the criteria to match against- Returns:
- the first artifact that matches the criteria. Null will be returned if no artifact matches
- Throws:
java.io.IOException- for errors while loading the model
-
listArtifacts
public java.util.List<Artifact> listArtifacts() throws java.io.IOException
Returns a list of artifacts in this resource.- Returns:
- a list of artifacts in this resource
- Throws:
java.io.IOException- for errors while loading the model
-
prepare
public void prepare(Artifact artifact) throws java.io.IOException
Prepares the artifact for use.- Parameters:
artifact- the artifact to prepare- Throws:
java.io.IOException- if it failed to prepare
-
prepare
public void prepare(Artifact artifact, ai.djl.util.Progress progress) throws java.io.IOException
Prepares the artifact for use with progress tracking.- Parameters:
artifact- the artifact to prepareprogress- the progress tracker- Throws:
java.io.IOException- if it failed to prepare
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-