Update index.html
Browse files- index.html +5 -11
index.html
CHANGED
@@ -107,17 +107,11 @@
|
|
107 |
}
|
108 |
} catch {
|
109 |
try {
|
110 |
-
|
111 |
-
`https://huggingface.co/${hf_model}`
|
112 |
-
).then(r => r.
|
113 |
-
|
114 |
-
|
115 |
-
let params_el = el.querySelector('div[data-target="ModelSafetensorsParams"]')
|
116 |
-
if (params_el !== null) {
|
117 |
-
model_size = JSON.parse(params_el.attributes.getNamedItem("data-props").value)["safetensors"]["total"]
|
118 |
-
} else {
|
119 |
-
params_el = el.querySelector('div[data-target="ModelHeader"]')
|
120 |
-
model_size = JSON.parse(params_el.attributes.getNamedItem("data-props").value)["model"]["safetensors"]["total"]
|
121 |
}
|
122 |
} catch {
|
123 |
throw new Error("Couldn't determine model size from safetensor/pytorch index metadata nor from the model card. If the model is an unsharded pytorch model, it is not supported by this calculator.")
|
|
|
107 |
}
|
108 |
} catch {
|
109 |
try {
|
110 |
+
model_size = await fetch(
|
111 |
+
`https://huggingface.co/api/models/${hf_model}`
|
112 |
+
).then(r => r.json())["safetensors"]["total"]
|
113 |
+
if (isNaN(model_size)) {
|
114 |
+
throw new Error("no size in pytorch metadata")
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
} catch {
|
117 |
throw new Error("Couldn't determine model size from safetensor/pytorch index metadata nor from the model card. If the model is an unsharded pytorch model, it is not supported by this calculator.")
|