Cannot load the model PhiForSequenceClassificationModified(basemodel.config)

#80
by lyliiiii - opened

when i am loading the following code:model = PhiForSequenceClassificationModified(basemodel.config),
there's an error: AttributeError: 'PhiForCausalLM' object has no attribute 'transformer'.
I successfully run this code before, but for this time there's an error.
Thanks for anyone who can help!!

Microsoft org

Hello @lyliiiii !

You are using a custom implemented class of PhiForSequenceClassificationModified. Please check https://github.com/huggingface/transformers/blob/main/src/transformers/models/phi/modeling_phi.py for updating your modeling file.

Also, ensure to use use trust_remote_code=True if below transformers==4.37.0.

Regards,
Gustavo.

gugarosa changed discussion status to closed

Thanks gugarosa.
I checked for the trust_remote_code=True, and my version of transformer can only updated with the latest 4.36.2
(ERROR: No matching distribution found for transformers==4.37.0)
And i am fine-tuning using colab. How can i fix this?
Thank you!

same issue,
if use self.model = basemodel.model will cause error:
RuntimeError: A view was created in no_grad mode and is being modified inplace with grad mode enabled. This view was created inside a custom Function (or because an input was returned as-is) and the autograd logic to handle view+inplace would override the custom backward associated with the custom Function, leading to incorrect gradients. This behavior is forbidden. You can fix this by cloning the output of the custom Function.

lyliiiii changed discussion status to open

Sign up or log in to comment