Package ai.djl.repository.zoo
Interface ModelLoader
- All Known Implementing Classes:
BaseModelLoader
public interface ModelLoader
A ModelLoader loads a particular
ZooModel
from a Repository for a model zoo.-
Method Summary
Modifier and TypeMethodDescription<I,
O> void downloadModel
(Criteria<I, O> criteria, ai.djl.util.Progress progress) Downloads the model artifacts to local directory.Returns the application of theModelLoader
.Returns the artifact ID of theModelLoader
.Returns the group ID of theModelLoader
.getMrl()
Returns theMRL
of theModelLoader
.<I,
O> boolean isDownloaded
(Criteria<I, O> criteria) Returnstrue
if the model is downloaded in local directory.<I,
O> ZooModel<I, O> Loads the model with the given criteria.
-
Method Details
-
getGroupId
String getGroupId()Returns the group ID of theModelLoader
.- Returns:
- the group ID of the
ModelLoader
-
getArtifactId
String getArtifactId()Returns the artifact ID of theModelLoader
.- Returns:
- the artifact ID of the
ModelLoader
-
getApplication
Application getApplication()Returns the application of theModelLoader
.- Returns:
- the application of the
ModelLoader
-
getMrl
MRL getMrl()Returns theMRL
of theModelLoader
.- Returns:
- the
MRL
of theModelLoader
-
loadModel
<I,O> ZooModel<I,O> loadModel(Criteria<I, O> criteria) throws IOException, ModelNotFoundException, MalformedModelExceptionLoads the model with the given criteria.- Type Parameters:
I
- the input data typeO
- the output data type- Parameters:
criteria
- the criteria to match against the loaded model- Returns:
- the loaded model
- Throws:
IOException
- for various exceptions loading data from the repositoryModelNotFoundException
- if no model with the specified criteria is foundMalformedModelException
- if the model data is malformed
-
isDownloaded
Returnstrue
if the model is downloaded in local directory.- Type Parameters:
I
- the input data typeO
- the output data type- Parameters:
criteria
- the criteria to match against the loaded model- Returns:
true
if the model is downloaded in local directory- Throws:
IOException
- for various exceptions loading data from the repositoryModelNotFoundException
- if no model with the specified criteria is found
-
downloadModel
<I,O> void downloadModel(Criteria<I, O> criteria, ai.djl.util.Progress progress) throws IOException, ModelNotFoundExceptionDownloads the model artifacts to local directory.- Type Parameters:
I
- the input data typeO
- the output data type- Parameters:
criteria
- the criteria to match against the loaded modelprogress
- the progress tracker- Throws:
IOException
- for various exceptions loading data from the repositoryModelNotFoundException
- if no model with the specified criteria is found
-