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

FutureWarning and UserWarning #73

Closed
cheuS1-n opened this issue Dec 12, 2022 · 5 comments
Closed

FutureWarning and UserWarning #73

cheuS1-n opened this issue Dec 12, 2022 · 5 comments

Comments

@cheuS1-n
Copy link

cheuS1-n commented Dec 12, 2022

D:\traiNNer\codes\models\base_model.py:921: FutureWarning: Non-finite norm encountered in torch.nn.utils.clip_grad_norm_; continuing anyway. Note that the default behavior will change in a future release to error out if a non-finite total norm is encountered. At that point, setting error_if_nonfinite=false will be required to retain the old behavior.
self.grad_clip(
C:\Python39\lib\site-packages\torch\optim\lr_scheduler.py:129: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
warnings.warn("Detected call of lr_scheduler.step() before optimizer.step(). "

How fix this?

@cheuS1-n cheuS1-n changed the title FutureWaarning and UserWarning FutureWarning and UserWarning Dec 12, 2022
@victorca25
Copy link
Owner

Hello!

D:\traiNNer\codes\models\base_model.py:921: FutureWarning: Non-finite norm encountered in torch.nn.utils.clip_grad_norm_; continuing anyway. Note that the default behavior will change in a future release to error out if a non-finite total norm is encountered. At that point, setting error_if_nonfinite=false will be required to retain the old behavior.

This means the model is probably unstable and some values are becoming InF. Normally gradient clipping will set those values to max at the defined values, but looks like this behavior is changing. You can try lowering the learning rate a bit to see if the error goes away, otherwise, there might be some other configuration causing these values to become infinite.

C:\Python39\lib\site-packages\torch\optim\lr_scheduler.py:129: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
warnings.warn("Detected call of lr_scheduler.step() before optimizer.step(). "

This is normal when using autocasting, no problem.

@cheuS1-n
Copy link
Author

Thanks for the answer! But I still have a problem, the program does not use video card, only video memory and and one epoch lasts for a very long time.
Core of video card dont used or used non correct, but only the processor. (G.Translate)
Знімок екрана 2022-12-13 093533

@victorca25
Copy link
Owner

How long is an epoch taking? Regarding the GPU utilization in Windows task manager, please check: #72

@cheuS1-n
Copy link
Author

cheuS1-n commented Dec 13, 2022

The epoch lasts 250-400 seconds(I don't know whether it is long but I think for a long time).
I load windows task manager screen, and GPU-Z.
image
image

Please tell us the video card is normally used? Because the uneven graphic is surprising. (Results from GPU Z and from WIndows Task Manager very different)

UPD. My bad, i dont check this issue(#72), how to include monitoring of cuda in windows task manager?

@victorca25
Copy link
Owner

How many images are you using for training? The time to complete a full epoch depends on how many images you have. More concretely, one epoch means that all the images have been used and it has to load all the images again with the dataloader.

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