You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something I've encountered in #284 and elsewhere (when integrating 3rd party libraries directly), is that folks may have to rewrite push_to_hub to fit their needs. However, it seems to me the only change you end up needing to make is specifying what needs to be saved.
I propose we do something like this:
add a generic push_to_hub function.
add a kwarg to this function, save_fn, that will allow users to pass a function that saves any assets specific to their model.
The logic would then look like the following:
defpush_to_hub(model, save_directory, ..., save_fn=None):
# Init/clone repo# ...# Run save func if provided or run the default if its notsave_fn=save_fnordefault_save_fnwithrepo.commit(commit_message):
save_fn(model, save_directory, config)
returnrepo.remote_url
I like the idea but let's see how to avoid duplication. This sounds very similar to the generic mixin, which has a generic push_to_hubmethod and users just need to overwrite _save_pretrained.
Anyways, +1 to this since we have push_to_hub repetition across multiple libraries, although let's be careful since each has some different things
Something I've encountered in #284 and elsewhere (when integrating 3rd party libraries directly), is that folks may have to rewrite
push_to_hub
to fit their needs. However, it seems to me the only change you end up needing to make is specifying what needs to be saved.I propose we do something like this:
push_to_hub
function.save_fn
, that will allow users to pass a function that saves any assets specific to their model.The logic would then look like the following:
What do you think? @LysandreJik @osanseviero
The text was updated successfully, but these errors were encountered: