Giter Site home page Giter Site logo

Parameter count about mamba HOT 2 CLOSED

state-spaces avatar state-spaces commented on August 15, 2024
Parameter count

from mamba.

Comments (2)

tridao avatar tridao commented on August 15, 2024

That would be strange, I'm getting 129M params:

In [1]: import torch

In [2]: from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel

In [3]: model = MambaLMHeadModel.from_pretrained("state-spaces/mamba-130m")

In [4]: sum(p.numel() for p in model.parameters())
Out[4]: 129135360

from mamba.

jmercat avatar jmercat commented on August 15, 2024

I was going to respond that:

from mamba_ssm import MambaLMHeadModel

params = {
    "d_model": 2560,
    "n_layer": 32,
    "vocab_size": 50432,
}

model = MambaLMHeadModel(**params)

num_param = sum(p.numel() for p in model.parameters() if p.requires_grad)
print(f"Number of parameters (local): {num_param}")

model = MambaLMHeadModel.from_pretrained("state-spaces/mamba-2.8b")

num_param = sum(p.numel() for p in model.parameters())
print(f"Number of parameters (downloaded): {num_param}")

gives:

Number of parameters (local): 1449006080
Number of parameters (downloaded): 2768345600

But I see you've updated the number of layers to the different configs. So problem solved.

from mamba.

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.