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

param.grad is None ! #40

Open
txdtplus opened this issue Apr 8, 2024 · 1 comment
Open

param.grad is None ! #40

txdtplus opened this issue Apr 8, 2024 · 1 comment

Comments

@txdtplus
Copy link

txdtplus commented Apr 8, 2024

Hi! Thank you for your great work!

After preparing datasets and pretrained model, I trained the model using this command:

randport=$(shuf -i8000-9999 -n1) # Generate a random port number
python -u main.py
--dist-url "tcp://127.0.0.1:${randport}" --dist-backend 'nccl'
--multiprocessing-distributed --world-size 1 --rank 0 --batch-size=256
--dataset=cc3m --val-dataset=cc3m
--exp-name='gill_exp' --image-dir='/data/vol1/public-datasets/03-CC/cc3m/' --log-base-dir='runs/'
--precision='bf16' --print-freq=100
--opt-version='/data/models/facebook/opt-6.7b' --visual-model='/data/pretrained_weights/openai/clip-vit-large-patch14' --workers=0

No code is modified execpt the data path. However, I got this error:

Traceback (most recent call last):
File "/root/miniconda3/envs/vlm/lib/python3.10/site-packages/torch/multiprocessing/spawn.py", line 74, in _wrap
fn(i, *args)
File "/data/vol1/zky/methods/gill/main.py", line 402, in main_worker
train(train_loader, model, tokenizer, criterion, optimizer, epoch, scheduler, args)
File "/data/vol1/zky/methods/gill/main.py", line 586, in train
assert param.grad.shape[0] == len(tokenizer)
AttributeError: 'NoneType' object has no attribute 'shape'

It seems like the parm in model.module.model.input_embeddings.parameters() has no grad. Could you teach me how to solve this problem? Thank you!

@linshan-79
Copy link

We encounter the same problem as you depicted, do you successfully solve it?

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