Code Monkey home page Code Monkey logo

Comments (2)

RahulSChand avatar RahulSChand commented on July 28, 2024

Hi @LaniakeaS this happens because to calculate memory requirement, one needs hidden_size, intermediate_size, num_layers, vocab_size of the model (these are usually present in config.json & the app reads it from there)

But when you just input the size, the app has no idea about above values & has to "infer" them based on some assumptions. This part of the code, approximates the values of hidden_size etc. using just the final size (in billion) of the model

gpu_poor/src/App.js

Lines 671 to 705 in a702c37

function getApprox(modelSize) {
let vocabR = null,
headsR = null,
numLayersR = null;
if (modelSize < 5) {
vocabR = 32000;
headsR = 32;
numLayersR = 24;
return [vocabR, headsR, numLayersR];
}
if (modelSize < 10) {
vocabR = 32000;
headsR = 32;
numLayersR = 32;
return [vocabR, headsR, numLayersR];
}
if (modelSize < 24) {
vocabR = 32000;
headsR = 40;
numLayersR = 40;
return [vocabR, headsR, numLayersR];
}
if (modelSize < 55) {
vocabR = 32000;
headsR = 64;
numLayersR = 48;
return [vocabR, headsR, numLayersR];
}
vocabR = 32000;
headsR = 64;
numLayersR = 80;
return [vocabR, headsR, numLayersR];
}

This causes a difference, because given just the final size of the model it's impossible to say what EXACT hidden_size etc. they had

from gpu_poor.

LaniakeaS avatar LaniakeaS commented on July 28, 2024

thank you for your answer!

from gpu_poor.

Related Issues (9)

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.