Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save fine tuned PaliGemma model? #424

Closed
SkalskiP opened this issue May 16, 2024 · 4 comments
Closed

How to save fine tuned PaliGemma model? #424

SkalskiP opened this issue May 16, 2024 · 4 comments
Labels
component:demos Update demos status:awaiting user response Awaiting a response from the author type:feature request New feature/request/enhancement

Comments

@SkalskiP
Copy link

Description of the feature request:

Hi 👋🏻

Thanks a lot for PaliGemma fine-tune example notebook. It worked without any issue. However, it lacks the last step - saving a fine-tuned model. (Or I'm just missing something.) I'd appreciate any help. Thank you. 🙏🏻

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

@SkalskiP SkalskiP added the type:feature request New feature/request/enhancement label May 16, 2024
@gokayfem
Copy link

+1 We need this

@selamw1
Copy link

selamw1 commented May 16, 2024

Hi @SkalskiP,

Based on this conversation at X, you can use numpy.savez, a function that efficiently stores multiple arrays in a single, uncompressed .npz format.

import big_vision.utils as bv_utils
flat, _ = bv_utils.tree_flatten_with_names(flat)
with open("ckpt.npz", "wb") as f:
  np.savez(f, **{k: v for k, v in flat})

And then load:

bv_utils.load_checkpoint_np("ckpt.npz")

@singhniraj08 singhniraj08 added status:awaiting user response Awaiting a response from the author component:demos Update demos labels May 17, 2024
@SkalskiP
Copy link
Author

Thanks a lot! @gokayfem I really appreciate the help.

@gokayfem
Copy link

It should be

flat, _ = bv_utils.tree_flatten_with_names(params)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:demos Update demos status:awaiting user response Awaiting a response from the author type:feature request New feature/request/enhancement
Projects
None yet
Development

No branches or pull requests

4 participants