andimarafioti / florence2-finetuning

Quick exploration into fine tuning florence 2
MIT License
241 stars 21 forks source link

config.json modified #12

Open gretameglioli opened 1 month ago

gretameglioli commented 1 month ago

Dear all, i was trying your finetuning code without using your dataset but converting mine so that it would fit the training process. I ran into a strange error saving the model. In your script, you use save_pretrained for each checkpoint, but I saved the model at the end. Even if the model itself, at the end of training step, worked correctly during inference, when I try to save it in a directory and then reload it the config.json file changed. In particular, model.config.vision_config.model_type which was "davit" became "" after the saving process. Do you know the reason? Thank you in advance.

gretameglioli commented 1 month ago

I forgot to write thet the problem I depicted in the previous message brought me to the following error wher I tried to load the model once saved.

AssertionError: only DaViT is supported for now

andimarafioti commented 1 month ago

You can edit the model_type on the config.json file and set it to "davit". I don't know why it's saved wrong by default :/ But after that change everything should work :)

jmtatsch commented 1 week ago

Confirmed working, make sure you alter model_type of vision_config and not one of the other model_types 🙃