Distilbert Seq2clas


I have two questions:
1 We can view the. pooled layer by using output_hidden_states=true and follow the logic, but is there a generic way to do so?

2 When we are doing inference, can we output the hidden_states from trainer.predict() as we do by model(input/output_hidden_states=True)?


I have a similar doubt as regards point 2.

I am working on Question Answering with Distilbert.
The predict function in the Trainer does not work if output_hidden_states = True. It works fine if the same argument is set to False.
Is this a bug? If not, then how is one to use a model for prediction if one has set the argument output_hidden_states = True while initializing the model ?

Found the solution. Posting it here just in case someone else too gets stuck with my particular problem.

I just had to pass ignore_keys = [‘attentions’] in the predict function and everything works fine.

@natank To answer your second question, I don’t think so because as seen in the predict function source code, it only returns predictions, label_ids and metrics.

Thanks for you replies. Regarding one it indeed resolved me a problem. Regarding your answer on q2. It seems that Huggingsface offer two working modes, research : use model , and model taining - use predict. Am I right?