Since models in the registry are associated with block information, we can use them
to automatically construct task-specific models using the taskmodel API (possibly
extended by an additional backend argument).
config = models()["torchvision/resnet18/backbone"]
backbone = load(config)
task = ImageSegmentation(_)
# build the task-specific model
model = taskmodel(task, # includes info about required input and target block for task
config.backend # dispatch on the DL library used, here :pytorch
backbone,
config.input, # backbone input block: `ImageTensor{2}(3)`
config.output) # backbone output block: `ConvFeatures{2}(512)`
learner = tasklearner(task, data; model)
fit!(learner, 10)
In addition to existing feature registries, FastAI.jl will be getting a model registry.
The model registry should allow
Examples
Some code examples to show how the model registry can be used:
Loading models
Load a pretrained ResNet implemented in Metalhead.jl for transfer learning:
Load the ResNet as an untrained backbone for a different task
Searching for models
Find models that take in preprocessed images:
Or find a suitable model for a supervised learning task directly:
List models implemented in PyTorch:
Find models of a certain size:
Training workflow
Since models in the registry are associated with block information, we can use them to automatically construct task-specific models using the
taskmodel
API (possibly extended by an additionalbackend
argument).