Last active
September 15, 2023 09:28
Revisions
-
antferdom revised this gist
Sep 15, 2023 . 1 changed file with 5 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,6 @@ import torch model_size = sum( p.numel() * p.element_size() for p in model.parameters() if p.requires_grad ) model_params = sum(p.numel() for p in model.parameters() if p.requires_grad) -
antferdom created this gist
May 24, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ import torch from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained('mosaicml/mpt-7b', trust_remote_code=True, torch_dtype=torch.bfloat16, ) model.eval() model.cuda() for name, param in model.named_parameters(): print(f"{name} Modelsize: {param.numel()/1000**2:.1f}M parameters") if "31" not in name: param.requires_grad = False print(name, param.requires_grad)