Skip to content

Selectively applying different optimizers to different groups. #734

Answered by awni
kgourgou asked this question in Q&A
Discussion options

You must be logged in to vote

No you don't need to freeze the different layers. For your specific case you would do something like:

model = Model(...)

def step(inputs, targets):
   loss, grads = loss_and_grad_function(model, inputs, targets)
   optimizer1.update(model.layer1, grads["layer1"])
   optimizer2.update(model.layer2, grads["layer2"])

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kgourgou
Comment options

Answer selected by kgourgou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants