tasklearner
function
defined in module
FastAI
tasklearner(task, traindata, validdata[; callbacks=[], kwargs...]) -> Learner
tasklearner(task, data; pctgval = 0.2, kwargs...)
Create a
Learner
to train a model for learning task
task
using
data
.
callbacks = []
:
Callback
s to use during training.
batchsize = 16
: Batch size used for the training data loader.
backbone = nothing
: Backbone model to construct task-specific model from using
taskmodel
(task, backbone)
.
model = nothing
: Complete model to use. If given, the
backbone
argument is ignored.
optimizer = Adam()
: Optimizer passed to
Learner
.
lossfn =
tasklossfn
(task)
: Loss function passed to
Learner
.
Any other keyword arguments will be passed to
taskdataloaders
.
Full example:
data
,
blocks
=
loaddataset
(
"
imagenette2-160
"
,
(
Image
,
Label
)
)
task
=
ImageClassificationSingle
(
blocks
)
learner
=
tasklearner
(
task
,
data
)
fitonecycle!
(
learner
,
10
)
Custom training and validation split:
learner
=
tasklearner
(
task
,
traindata
,
validdata
)
Using callbacks:
learner
=
tasklearner
(
task
,
data
;
callbacks
=
[
ToGPU
(
)
,
Checkpointer
(
)
,
LogMetrics
(
TensorboardBackend
(
)
)
]
)
There are
2
methods for FastAI.tasklearner
:
The following pages link back here:
Custom learning tasks, FastAI.jl, Feature registries in FastAI.jl, How to log to TensorBoard, How to train a model, Image segmentation, Introduction, Performant data pipelines, Quickstart, Saving and loading models for inference, Tabular Classification, fastai API comparison