SetFit customized model head got " maximum recursion depth exceeded" errors

Hi, I am trying to customize my own SetFitHead with the scripts as below:


. I have run smoothly with setfit trainer but today I suddenly got
" maximum recursion depth exceeded" errors. If I exchange the head as SetFitHead then it works again. Can anyone help with this ?

The error happens in when I call “trainer.train()”