keras-team / keras-hub

Pretrained model hub for Keras 3
Apache License 2.0
804 stars 243 forks source link

Allow backbone to be any functional, preprocessor any callable #1900

Closed mattdangerw closed 1 month ago

mattdangerw commented 1 month ago

The main change this allows is passing arbitrary functional models as a backbone to a task and arbitrary callables as preprocessing for a task. This should allow a lot more flexible API usage.

I also moved our saving routines to a PresetSaver class, but this is really just to be parallel with the PresetLoader we added for transformers/timm conversion. You can still override save_to_preset on a model if you need to. Probably more cleanups to do.

mattdangerw commented 1 month ago

Merging this! The last failure is unrelated, and has to do with image preprocessing on the torch backend and gpu <> cpu errors. I will fix up on the other PR.