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

No gradients for any parameters #126

Open
antonioo-c opened this issue Aug 24, 2024 · 0 comments
Open

No gradients for any parameters #126

antonioo-c opened this issue Aug 24, 2024 · 0 comments

Comments

@antonioo-c
Copy link

Greak work! But i have a problem when finetuning the model. I added the following code in main/trainer.py file, trying to inspect the gradients for the dynamicrafter model when fintuning on my own dataset, but i see all None gradient for every parameters in the model, why is that happenning?

 class PrintGradientsCallback(pl.Callback):
        def on_after_backward(self, trainer, pl_module):
            print("Gradients after backward pass:")
            for name, param in pl_module.named_parameters():
                if param.grad is not None:
                    print(f"Gradient of {name}: {param.grad.norm()}")
    trainer_kwargs["callbacks"].append(PrintGradientsCallback())
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