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

Minimizing cpu RAM vs only use GPU RAM #199

Closed
vince62s opened this issue Feb 6, 2024 · 1 comment
Closed

Minimizing cpu RAM vs only use GPU RAM #199

vince62s opened this issue Feb 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@vince62s
Copy link

vince62s commented Feb 6, 2024

🚀 Feature

Load model directly on GPU when available instead of 1) CPU 2) GPU

Motivation

Trying to use comet-score with cometkiwi-xl on Colab

Currently, the load_checkpoint method forces to load on torch.device("cpu").
On Colab Free there is only 12GB of cpu RAM, hence XL does not fit.

Then I switched in init.py torch.device() to "cuda"
Now it loads the model on GPU fine

BUT just before starting to score, the cpu RAM suddenly jumps to > 12GB, not sure to understand why.

Any clue ?

@vince62s vince62s added the enhancement New feature or request label Feb 6, 2024
@vince62s
Copy link
Author

vince62s commented Feb 6, 2024

usually, the way it should work is:

  1. build model on meta device (empty weights) so it takes zero ram
  2. load directly weights from checkpoint to GPU
    I am trying to amend the code, but no luck so far.

@vince62s vince62s closed this as completed Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant