How to get model size?
Hi, everyone!Is there a quick way to get model size for an arbitrary transformers model?
2021-10-25T07:46:38Z
Hi🤗Do you mean size in mb or the number of the parameters used?Regarding size check this:stackoverflow.comHow to get the size of a Hugging Face pretrained model?python, deep-learning, nlp, pytorchanswered byTobias H&#246;lzeron05:23PM - 28 Jun 21 UTCRegarding the number of the parameters in PyTorch you can use:sum(p.numel() for p in model.parameters())
2021-10-25T09:21:48Z
For me, the simplest way is to go to the “Files and versions” tab of a given model on the hub, and then check the size in MB/GB of thepytorch_model.binfile (or equivalently, the Flax/Tensorflow model file).e.g.GPT-J-6Bis 22.5 GB, as can be seen here:Schermafbeelding 2021-10-25 om 11.19.511912×1380 284 KB
2021-10-25T19:03:08Z
Hi Kirill!Thank you!Inspired by the number-of-parameters part of your answer I figured, I could actually get it in a slightly simpler way:model.num_parameters()which returns the same number as your solution.Thanks for help!
2021-10-25T19:04:15Z
Hi Niels!Thank you!!
2022-10-09T19:33:40Z
Is there a way to sort or filter models by file size?
2023-07-15T18:30:54Z
Is there a way to get the size of pytorch_model.bin without actually downloading the file?mteb/leaderboard · Add size and language to table?Nevermind, figured it out:git clone --no-checkout https://huggingface.co/intfloat/multilingual-e5-large
cd multilingual-e5-large\λ git lfs ls-files -s
020afdebf2 - model.safetensors (2.2 GB)
bb5a52503a - onnx/model.onnx (546 KB)
0cf1883fee - onnx/model.onnx_data (2.2 GB)
cfc8146abe - onnx/sentencepiece.bpe.model (5.1 MB)
62c24cdc13 - onnx/tokenizer.json (17 MB)
9aaa222c5a - pytorch_model.bin (2.2 GB)
cfc8146abe - sentencepiece.bpe.model (5.1 MB)
62c24cdc13 - tokenizer.json (17 MB)Even better:λ git lfs ls-files -s --include=pytorch_model.bin
9aaa222c5a - pytorch_model.bin (2.2 GB)