DNABERT_2 icon indicating copy to clipboard operation
DNABERT_2 copied to clipboard

Unable to Retrieve ' hidden_states ' Despite ' Setting return_dict=True ' and ' output_hidden_states=True '

Open biglittleme opened this issue 1 month ago • 3 comments

Hello, I am currently working with the zhihan1996/DNABERT-2-117M model to extract features from DNA sequences and am encountering an issue with accessing the hidden states of the model.

Issue Description Despite setting return_dict=True and output_hidden_states=True, the output from the model remains a tuple rather than the expected ModelOutput object that includes the .hidden_states attribute. When attempting to access outputs.hidden_states, I encounter the following error: AttributeError: 'tuple' object has no attribute 'hidden_states'

Additionally, I have used the following code to check the type and attributes of the output object, confirming that it indeed returns a tuple, which lacks the ' hidden_states ': print(type(outputs)) print(dir(outputs))

Environment Setup Transformers version: 4.29.2 (as specified in the requirements.txt)

I would appreciate any guidance or suggestions on how to resolve this issue. Thank you for your time and assistance!

biglittleme avatar May 07 '24 07:05 biglittleme