I am trying to access output of hidden layers for BLIP caption generator with code output=model(**inputs, output_hidden_states=true). I observed that this significantly slowed down the inference as it calculates, stores all the hidden layer outputs. it is taking approximately 6 seconds for inference. Is there any way I can access only certain hidden states instead of outputs from all hidden states? or speedup inference ?
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Accessing hidden states faster/only some hidden states | 0 | 91 | May 22, 2024 | |
BLIP2 GreedySearchDecoderOnlyOutput, how can I extract the activations of a certain hidden layer? | 0 | 145 | July 5, 2023 | |
Get each generated token last layer hidden state | 3 | 56 | March 16, 2025 | |
BertForSequenceClassification: Can I get the last hidden state? | 0 | 757 | January 9, 2023 | |
T5.generate() cannot get hidden states although output_hidden_states=True | 0 | 550 | July 9, 2022 |