Training Models
trainable: true
. The model assistant allows the user to define a training store, can capture training options. If we want to allow our model to be trained, we also need to provide a train
function.
📘 Training Options It is important to note that in the inference we pass the training options as a parameters, however in the training we pass the training options as a dictionary.The
train
function is called by the model runtime when the model is trained. The training_store
is the store is the document store that the user has selected to use for training. The training_options
are the options that the user has selected for training. The model_data
is a directory that the model can use to store “trained model”. A model can store anything in the model_data
directory. This contains the model_data
directory will be stored in the model store as a Model Training.
We place the responsibility of iterating over the documents in the training store and training model on the model. This provides flexibility in how the model wants to process all the training documents. Once completed, the model can save any “trained materials” in model_data
.
train
function. This parameter is additional_training_document
. This will be an instance of a KodexaDocument.
📘 Additional Training Document The additional training document should always be a KodexaDocument. However, it is important to note that you need to confirm (using the path of the Kodexa Document) that you don’t pick up the same document from the training store.We can see below an example of how you might write the logic to allow you to train:
model_base
, this will be the folder where the model code has been deployed.