Hi @arhouati,
Thanks for reporting your issue and progress on it here.
I believe I ran into the same issue while finetuning a BERT-based model.
My code seems to be similar to what you implemented, and I tried all other “parameters are not updating” suggestions (for some days now).
If you have time, it would help a lot if you could share which operations made your computational graph break. Does it break where you wrap the entity_logits into a tensor?
Thanks,
Madelon

Update: I just solved my problem. I had to convert my sample labels and another variable (sample size) to pytorch Variables (pytorch.autograd.Variables) to be included in the computational graph. Hope this is helpful for future readers.