doesn't work well with transformers >= 4.52.1

#104
by kimsia - opened
lib/python3.12/site-packages/torch/nn/modules/module.py", line 1940, in __getattr__
    raise AttributeError(
AttributeError: 'DaViT' object has no attribute '_initialize_weights'

No such issue when transformers 4.51.3

But, I get this issue when using with transformers 4.52.1 and higher (was using 4.52.3)

I can confirm 4.51.3 has no issues

It's broken above 4.49...Please fix this otherwise I'll be forced to no longer use these great models...

https://github.com/huggingface/transformers/issues/36886

Hi, I’m facing an issue while trying to load the DaViT model.
When I instantiate the model, I get the following error:

AttributeError: 'DaViT' object has no attribute '_initialize_weights'

Please define the _initialize_weights function in the DaViT class, or remove the call if it’s not needed (especially if the model is pretrained and doesn’t require reinitialization).

Kindly guide me on this as soon as possible (ASAP).

Thanks in advance!

gopi123456789987654321

Just downgrade transformers

That’s what I did

kimsia

it is working now

Thank you very much

It's broken above 4.49...Please fix this otherwise I'll be forced to no longer use these great models...

https://github.com/huggingface/transformers/issues/36886

Not correct. Works with 4.51.3

AttributeError: 'DaViT' object has no attribute '_initialize_weights'

My investigation of this problem showed that the problem is not only in transformers, but in the incompatibility of triton and xformers versions.
In the end, I had to manually remove folders torch, torchvision, torchaudio. Install torch==2.7.1 for cu126, transformers==4.51.1, triton==3.2.0+gited43d228, xformers==0.0.31
And only after that the problems disappeared.

Sign up or log in to comment