Code Monkey home page Code Monkey logo

Comments (11)

apaszke avatar apaszke commented on May 27, 2024

Weights can be initialized in model's __init__, so it has nothing to do with the imagenet example, right?

As for lr schedule, I think we can just do sth like

if hasattr(model, 'lr_schedule'):
    lr = model.lr_schedule(epoch)
else:
    lr = args.lr * (0.1 ** (epoch // 30))

from vision.

colesbury avatar colesbury commented on May 27, 2024

I've been trying to put weight initialization as part of the model, since it often seem particular to the type of architecture. I added it to the ResNet definition and I'm going to add it to the VGG model def:
https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py#L112

I'm not sure about learning rate schedule. It seems awkward to put it as part of the model definition, but as you point out, hard coding it in the ImageNet example isn't ideal either

from vision.

Maratyszcza avatar Maratyszcza commented on May 27, 2024

@apaszke @colesbury Thanks, I will do the same for SqueezeNet. Are there pre-defined initialization functions/classes for popular initialization schemes (e.g. like in Neon or Keras)?

@colesbury I think ideally we should provide a default learning schedule as a part of torch.vision models and let users override it via command-line arguments.

from vision.

apaszke avatar apaszke commented on May 27, 2024

Yes, we should add them in nn somewhere.

from vision.

eladhoffer avatar eladhoffer commented on May 27, 2024

What do you think about this kind of regime inside of the model?
https://github.com/eladhoffer/convNet.pytorch/blob/master/models/alexnet.py

from vision.

apaszke avatar apaszke commented on May 27, 2024

Can't open it, are you sure the link is correct and the repo is public?

from vision.

eladhoffer avatar eladhoffer commented on May 27, 2024

How about https://raw.githubusercontent.com/eladhoffer/convNet.pytorch/master/models/alexnet.py
The repo is public

from vision.

apaszke avatar apaszke commented on May 27, 2024

That's one way to approach it, but I'm not sure if it's the most convenient one. Having a function that returns an optimizer for a given epoch seems more powerful.

from vision.

alykhantejani avatar alykhantejani commented on May 27, 2024

Is there/will there be a nice way to adapt the learning rate or momentum but keep other state in the optimizer, i.e. for Adam

from vision.

alykhantejani avatar alykhantejani commented on May 27, 2024

Should this issue be moved to the pytorch repo instead?

from vision.

vfdev-5 avatar vfdev-5 commented on May 27, 2024

As you, guys, speak also here about weight initialization, what about DenseNet if we want to use a not pretrained model ?
According to Caffe official implementation, convolutions are initialized with something like kaiming_normal.

from vision.

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.