History and Config in Keras repositories
See original GitHub issueThis is a feature request and discussion between @ariG23498 and me 😂 Wanted to carry this here for opinions.
Aritra thinks it would be cool to have history in repository directly, currently we only write model.history.history
in model card.
Also if the config dictionary is not provided by the user, we can load the config with get_config
(see here for more reference) and host it on the repository. If user provides config as argument, it can be overridden (which I think is not used that much atm).
From what I see in API reference of Keras, this makes models more lightweight and reduces serialization time, so
- User setting
save_traces = False
yet savingconfig
in the repository - Loading
config
and passing it in custom objects for loading the model should suffice and would be a nice option for users. (correct me if I’m wrong, @ariG23498)
These are both super nice to have, I’ll be releasing my blog without these and later add them. One consideration is we don’t want to add any argument because mixin takes **model_save_kwargs
or deprecate config
, allow user to override instead.
Pinging @nateraw and @gante because I want to know what they think (it’s optional, feel free to pass 🤗)
Also, Aritra accepted to co-author this PR with me which I’m super happy of 🥺
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:16 (16 by maintainers)
Top GitHub Comments
So IIRC when we made the original implementation, we intentionally avoided loading config this way because it seemed quite complicated. 😅 I definitely think you’re right in that we could do something a bit better.
Right now, you just get the
model.config
attribute added to your model instance if config is found:https://github.com/huggingface/huggingface_hub/blob/7042df38a9839ac41efd60cf7f985d473c49d426/src/huggingface_hub/keras_mixin.py#L525
How are we going to validate that the config that’s found is going to be valid for something like
from_config
for a given model? Couldn’t this potentially start breaking previously uploaded models somehow? (sorry if I’m missing something here 😅)Also, if folks already aren’t really using:
Do we expect users to use it for
get_config
/from_config
in custom models?As for history, which is a separate issue, I think that sounds great to include it as some dictionary file
history.json
. 🤗On top of what @merveenoyan documented brilliantly I also think we should compare the the pytorch auto-filling of cards with that of Keras. If we can align the expectation it would be a more controlled effort in building this API better.
WDYT?