How to add training end callback to AllenNLP config file?
Currently training models using AllenNLP 1.2 and the commands api:
allennlp train -f --include-package custom-exp /usr/training_config/mock_model_config.jsonnet -s test-mock-out
I'm trying to execute a forward pass on a test dataset after training is completed. I know how to add an epoch_callback, but am not sure about the syntax for the end_callback.
In my config.json, I have the following:
{
...
&quot;trainer&quot;: {
...
&quot;epoch_callbacks&quot;: [{&quot;type&quot;: 'log_metrics_to_wandb',},]
}
...
}

I've tried:
              &quot;end_callback&quot;: [{&quot;type&quot;: 'my_custom_function',},]

but got an illegal argument error. Also, I am not sure how I would accurately specify the exact custom function and communicate it to the trainer.

I think you can create a new callback function/object that inherits from TrainerCallback and override the on_end method, and then it should work as expected if you register it the same way as you did log_metrics_to_wandb above.
