Code Monkey home page Code Monkey logo

Comments (8)

eugval avatar eugval commented on August 23, 2024 2

Hello!

Is there a consensus on this? Unless I am missing something, I also think you might need create_graph = True in order to propagate your gradients correctly through the inner gradient.

from maml-pytorch.

Deng-Y avatar Deng-Y commented on August 23, 2024 2

I also think it needs create_graph = True.
grad = torch.autograd.grad(loss, self.net.parameters())
My understanding is that the line above will give you grad.requires_grad = False. Thus, there is no higher order gradients available. It's a first order MAML.
grad = torch.autograd.grad(loss, self.net.parameters(), create_graph = True)
The line above will give you grad.requires_grad = True.

from maml-pytorch.

dragen1860 avatar dragen1860 commented on August 23, 2024

Generally speaking, you should set create_graph for 2nd order gradient.
However, the implementaton in this repo. is the 2nd order version.

from maml-pytorch.

lynlynlyn avatar lynlynlyn commented on August 23, 2024

I use pytorch1.0.The default setting create_graph is False.
And I checked the grad on Meta.py line 86 and line116.
grad = torch.autograd.grad(loss, fast_weights)
The require_grads about grad is False.
I am not sure the implementaton in this repo. is the 2nd order version.

from maml-pytorch.

dragen1860 avatar dragen1860 commented on August 23, 2024

@lynlynlyn IT's 2nd order implementation.
I think you should digest the paper to understand how to derive 2nd order gradient.
It's not simply set create_graph=True.
Sorry.

from maml-pytorch.

lynlynlyn avatar lynlynlyn commented on August 23, 2024

if the inner loop gradients's require_grads=False,where is the 2nd order gradient?

from maml-pytorch.

dragen1860 avatar dragen1860 commented on August 23, 2024

@Deng-Y well, I have not worked on this project a long time. sorry for misleading information. Have you tried setting create_grape=True?

from maml-pytorch.

Deng-Y avatar Deng-Y commented on August 23, 2024

@dragen1860 I only try it on the other project. Not sure if it will improve the performance on this one.

from maml-pytorch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.