Skip to content

Commit a648319

Browse files
committed
WE DO NOT USE THIS && BULLSHIT
1 parent 210fc47 commit a648319

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/hub/src/lib/parse-safetensors-metadata.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,11 @@ export async function parseSafetensorsMetadata(
231231
return {
232232
sharded: false,
233233
header,
234-
...(params.computeParametersCount && {
235-
parameterCount: computeNumOfParamsByDtypeSingleFile(header),
236-
}),
234+
...(params.computeParametersCount
235+
? {
236+
parameterCount: computeNumOfParamsByDtypeSingleFile(header),
237+
}
238+
: undefined),
237239
};
238240
} else if (
239241
(params.path && RE_SAFETENSORS_INDEX_FILE.test(params.path)) ||
@@ -244,9 +246,11 @@ export async function parseSafetensorsMetadata(
244246
sharded: true,
245247
index,
246248
headers,
247-
...(params.computeParametersCount && {
248-
parameterCount: computeNumOfParamsByDtypeSharded(headers),
249-
}),
249+
...(params.computeParametersCount
250+
? {
251+
parameterCount: computeNumOfParamsByDtypeSharded(headers),
252+
}
253+
: undefined),
250254
};
251255
} else {
252256
throw new Error("model id does not seem to contain safetensors weights");

0 commit comments

Comments
 (0)