Package ai.djl.repository
Class MRL
java.lang.Object
ai.djl.repository.MRL
The
MRL
(Machine learning Resource Locator) is a pointer to a Metadata
"resource"
on a machine learning Repository
.
Each mrl references a single metadata file (parsed to Metadata
and 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
Modifier and TypeMethodDescriptionstatic MRL
dataset
(Repository repository, Application application, String groupId, String artifactId, String version) Creates a datasetMRL
with specified application.Returns the application.Returns the artifactId.Returns the default artifact.Returns the groupId.Returns the repository.Returns the version.boolean
isPrepared
(Artifact artifact) Returnstrue
if the artifact is ready for use.Returns a list of artifacts in this resource.Returns the first artifact that matches a given criteria.static MRL
model
(Repository repository, Application application, String groupId, String artifactId, String version, String artifactName) Creates a modelMRL
with specified application.void
Prepares the artifact for use.void
Prepares the artifact for use with progress tracking.toString()
toURI()
Returns the URI to the metadata location (used forRepository
implementations).static MRL
undefined
(Repository repository, String groupId, String artifactId) Creates a datasetMRL
with specified application.
-
Method Details
-
model
public static MRL model(Repository repository, Application application, String groupId, String artifactId, String version, String artifactName) Creates a modelMRL
with specified application.- Parameters:
repository
- theRepository
application
- 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, String groupId, String artifactId, String version) Creates a datasetMRL
with specified application.- Parameters:
repository
- theRepository
application
- the desired applicationgroupId
- the desired groupIdartifactId
- the desired artifactIdversion
- the resource version- Returns:
- a dataset
MRL
-
undefined
Creates a datasetMRL
with specified application.- Parameters:
repository
- theRepository
groupId
- the desired groupIdartifactId
- the desired artifactId- Returns:
- a dataset
MRL
-
toURI
Returns the URI to the metadata location (used forRepository
implementations).- Returns:
- the URI to the metadata location
-
getRepository
Returns the repository.- Returns:
- the repository
-
getApplication
Returns the application.- Returns:
- the application
-
getGroupId
Returns the groupId.- Returns:
- the groupId
-
getArtifactId
Returns the artifactId.- Returns:
- the artifactId
-
getVersion
Returns the version.- Returns:
- the version
-
getDefaultArtifact
Returns the default artifact.- Returns:
- the default artifact
- Throws:
IOException
- for various exceptions depending on the specific dataset
-
match
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:
IOException
- for errors while loading the model
-
listArtifacts
Returns a list of artifacts in this resource.- Returns:
- a list of artifacts in this resource
- Throws:
IOException
- for errors while loading the model
-
isPrepared
Returnstrue
if the artifact is ready for use.- Parameters:
artifact
- the artifact to prepare- Returns:
true
if the artifact is ready for use- Throws:
IOException
- if it failed to prepare
-
prepare
Prepares the artifact for use.- Parameters:
artifact
- the artifact to prepare- Throws:
IOException
- if it failed to prepare
-
prepare
Prepares the artifact for use with progress tracking.- Parameters:
artifact
- the artifact to prepareprogress
- the progress tracker- Throws:
IOException
- if it failed to prepare
-
toString
-