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

inf value occurs during forwarding process when fine-tuning VL branch with LLAVA-150K+MiniGPT4-3.5K+webvid-instruct #138

Open
2 tasks done
xuboshen opened this issue Jan 4, 2024 · 1 comment

Comments

@xuboshen
Copy link

xuboshen commented Jan 4, 2024

Great works! But I've met some problems and hope anyone has some ideas.

When I fine-tune the VL branch only with LLaMA-2 on image/video instruction datas, inf values occurs and the value of torch.max(hidden_states) and torch.min(hidden_states) becomes larger and larger.

Several attempts have been made:

  • I have already checked the issue lists.
  • I have consulted the huggingface forum and searched the google results.

Preparations:

My platform: 8*A6000 48G, the environment is setup exactly following the environment.yml in this repository.
The data is prepared following LLaVa (coco), WebVid-10M and MiniGPT-4.
7B LLaMA-2 Pretrained weights are from this repo as well.

The demo correctly runs on remote platform, and training process seems correct. I did not modify any code here.

Problem

I found that some data can occur 'inf' numbers at the last layer of LLaMA-2, where the index of decoder layer number is 31 in the autoregressive loop in LLaMA-2. The error does not occurs immediately, instead, the value of torch.max(hidden_states) and torch.min(hidden_states) becomes larger and larger for positives / smaller and smaller for negatives.

-inf of hidden_states
training

Do you or anyone have any ideas on why this problem occurs, and how to solve it? I appreciate anyone's time and help in advance.

@xuboshen
Copy link
Author

xuboshen commented Jan 4, 2024

I actually try to set batchsize=1 and the training proceeds as expected, while batchsize=4 produces inf values and fails training.

Could anyone explain this phenomenon?

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

1 participant