Coder Social home page Coder Social logo

Comments (5)

cgravill avatar cgravill commented on August 20, 2024 2

Perhaps we should add an option to control collecting history?

Hype/src/Hype/Optimize.fs

Lines 370 to 384 in 366daa7

module Params =
let Default = {Epochs = 100
LearningRate = LearningRate.DefaultRMSProp
Momentum = NoMomentum
Loss = L2Loss
Regularization = Regularization.DefaultL2Reg
GradientClipping = NoClip
Method = GD
Batch = Full
EarlyStopping = NoEarly
ImprovementThreshold = D 0.995f
Silent = false
ReturnBest = true
ValidationInterval = 10
LoggingFunction = fun _ _ _ -> ()}

It could default on but allow people with large models to disable without having to recompile.

Does anyone have an optimization real use case they could share? We could potentially speed it up as well.

from hype.

zgrkpnr avatar zgrkpnr commented on August 20, 2024

@adicirstei I can offer you my solution, but it requires you to modify source code.

In Optimize.fs find the line whist <- [w] @ whist and comment it out or delete it.
This line accumulates all the weight history which gets very large if your model is large. After that, it works great.

from hype.

adicirstei avatar adicirstei commented on August 20, 2024

Thanks @zgrkpnr!

I'll give it a try. Hope I'll be able to compile it.

from hype.

smoothdeveloper avatar smoothdeveloper commented on August 20, 2024

@zgrkpnr do you remember what was the size of that list when you got OutOfMemory?

Looking at the code quickly, it feels this should actually be a ResizeArray (initialized with a size matching iters), this would also make the last step (where it is currently reversed and converted to array) faster.

This change could save roughly 4 bytes per element.

from hype.

zgrkpnr avatar zgrkpnr commented on August 20, 2024

@smoothdeveloper Let's say our model has 900,000 parameters to optimize (which is quite normal for deep structures). 100 minibacthes and 10 Epochs for each brings us 100 x 10 x 900,000 single precision floating points of the size 3.4 b bytes. Roughly 3GB. I may be wrong, of course.

@adicirstei If the solution works, let me know.

from hype.

Related Issues (6)

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.