Bram Vanroy
commited on
Commit
·
0482c4b
1
Parent(s):
da46c4a
use model_info because Omar tells me to :-(
Browse files
generate_overview_json.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
import json
|
2 |
from pathlib import Path
|
3 |
|
4 |
-
from huggingface_hub import
|
5 |
from tqdm import tqdm
|
6 |
from transformers import AutoModelForCausalLM
|
7 |
|
8 |
|
9 |
def get_num_parameters(model_name: str) -> int:
|
10 |
try:
|
11 |
-
|
12 |
-
return
|
13 |
except Exception:
|
14 |
return AutoModelForCausalLM.from_pretrained(model_name).num_parameters()
|
15 |
|
|
|
1 |
import json
|
2 |
from pathlib import Path
|
3 |
|
4 |
+
from huggingface_hub import model_info
|
5 |
from tqdm import tqdm
|
6 |
from transformers import AutoModelForCausalLM
|
7 |
|
8 |
|
9 |
def get_num_parameters(model_name: str) -> int:
|
10 |
try:
|
11 |
+
info = model_info(model_name)
|
12 |
+
return info.safetensors["total"]
|
13 |
except Exception:
|
14 |
return AutoModelForCausalLM.from_pretrained(model_name).num_parameters()
|
15 |
|