Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLM parameters count #2

Open
simonwang517 opened this issue Aug 12, 2024 · 1 comment
Open

LLM parameters count #2

simonwang517 opened this issue Aug 12, 2024 · 1 comment

Comments

@simonwang517
Copy link

When I add following code in script train.py (function init_model) to count LLM parameters

params_llm = 0
    for k,v in llm_model.named_parameters():
        print(k, v.shape, v.numel())
        params_llm += v.numel()
    print('llm total params: {:.2f}M'.format( params_llm / 1024 / 1024)) 

I always get

transformer.wte.weight torch.Size([0]) 0
transformer.h.0.ln_1.weight torch.Size([0]) 0
transformer.h.0.attn.c_attn.weight torch.Size([0]) 0
transformer.h.0.attn.c_attn.bias torch.Size([0]) 0
transformer.h.0.attn.c_proj.weight torch.Size([0]) 0
transformer.h.0.ln_2.weight torch.Size([0]) 0
transformer.h.0.mlp.w1.weight torch.Size([0]) 0
transformer.h.0.mlp.w2.weight torch.Size([0]) 0
transformer.h.0.mlp.c_proj.weight torch.Size([0]) 0
transformer.h.1.ln_1.weight torch.Size([0]) 0
transformer.h.1.attn.c_attn.weight torch.Size([0]) 0
transformer.h.1.attn.c_attn.bias torch.Size([0]) 0
transformer.h.1.attn.c_proj.weight torch.Size([0]) 0
... ...

Is it be normal? or will that affect model training?

@robin1001
Copy link
Contributor

I'm not sure, where did you put the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants