Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

grad clip correctness #136

Open
Open

Description

@Whalefishin

Hello, I'm using higher for bilevel optimization and need to do gradient clipping in the lower level problem. I know that this can be done with a callback on the step() method, but when I take the gradient with respect to the lower level optimization, the computed gradient doesn't match with the finite difference results. I double checked that the higher version of optimizer gives the same optimization trajectory as their vanilla versions, so the callback gradient clip should be correct. In addition, the implemented finite difference check passes when gradient clipping is disabled.

Here is a fairly minimal example:
bilevel_example_checkgrad.zip
which is adapted from https://github.com/vis-opt-group/IAPTT-GM/blob/main/experiment/Numerical.py. Can someone see if this is correct? Many thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions