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

Hitting OOM in model loading in multi GPU setting #3194

Open
rupeshgx opened this issue Jan 23, 2025 · 1 comment
Open

Hitting OOM in model loading in multi GPU setting #3194

rupeshgx opened this issue Jan 23, 2025 · 1 comment

Comments

@rupeshgx
Copy link

My code:

def main():
    # 1. Load a model to finetune
    model = SentenceTransformer(
        model_name_or_path=Alibaba-NLP/gte-Qwen2-7B-instruct,
        tokenizer_kwargs={
            "model_max_length": 512,
            "truncation": True
        }
    )
    # set the max input seq length to 512
    model.max_seq_length = 512


if __name__ == "__main__":
    main()

When I run this code on one H100 GPU (which has 80 GB memory) I am able to load the model successfully. The model consumes 28GB of memory.

However, when I run the same code on 8 H100 GPUs (torchrun --nproc_per_node=8 finetuning.py) I get OOM with the following error message:

torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 260.00 MiB. GPU 0 has a total capacity of 79.10 GiB of which 57.06 MiB is free. Process 1552209 has 9.94 GiB memory in use. Process 1552212 has 9.94 GiB memory in use. Process 1552208 has 9.94 GiB memory in use. Process 1552211 has 9.68 GiB memory in use. Process 1552213 has 9.94 GiB memory in use. Process 1552210 has 9.94 GiB memory in use. Process 1552214 has 9.68 GiB memory in use. Process 1552215 has 9.94 GiB memory in use ...

What am I doing wrong?

@13918763630
Copy link

I also have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants