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.

Keyword arguments

  • callbacks = []: Callbacks 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.

Examples

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
			(
			)
			)
			

			]
			)