examples/research_projects/rag-end2end-retriever/callbacks_rag.py/count_trainable_parameters
def count_trainable_parameters(model):
    model_parameters = filter(lambda p: p.requires_grad, model.parameters())
    params = sum([np.prod(p.size()) for p in model_parameters])
    return params