faustomorales / vit-keras

Keras implementation of ViT (Vision Transformer)
Apache License 2.0
336 stars 80 forks source link

load fine-tuned model with keras.load_model #35

Open HurongCSU opened 2 years ago

HurongCSU commented 2 years ago

I finetuned the vit_b16 model with new data and saved the new model by "save". When I load this retrained model, ending up with "TypeError: call () missing 1 required positional argument: 'training' " . Any suggestions? Thanks!

dgrnd4 commented 2 years ago

@HurongCSU can you show your file with the steps that you're taking to do Fine-Tuning?

wtw11mdg commented 2 years ago

The same issue here~ I ran the first demo code mentioned in the Usage part, but it shows the same error above.

Is there anything I can do~? Thanks!

Mten7271 commented 1 year ago

I encountered this error and found out what is causing it. I think it happened in TransformerBlock class in vit_keras/layers.py. https://github.com/faustomorales/vit-keras/blob/28815edc5c24492612af726d1b2ca78295128d84/vit_keras/layers.py#L167 I manually changed the source code and fixed the error.

kenzo94 commented 1 year ago

@Mten7271 how did you change it?