( entries: readonly HuggingFaceDatasetTreeEntry[], treePath: string )
| 389 | } |
| 390 | |
| 391 | export function getHuggingFaceSplatPaths( |
| 392 | entries: readonly HuggingFaceDatasetTreeEntry[], |
| 393 | treePath: string |
| 394 | ): RemoteSplatCandidate[] { |
| 395 | const candidates: RemoteSplatCandidate[] = []; |
| 396 | |
| 397 | for (const entry of entries) { |
| 398 | if (entry.type !== 'file' || typeof entry.path !== 'string' || typeof entry.size !== 'number') { |
| 399 | continue; |
| 400 | } |
| 401 | |
| 402 | const relativePath = getRelativeHuggingFaceTreePath(entry.path, treePath); |
| 403 | if (!relativePath || !isSplatFilePath(relativePath)) { |
| 404 | continue; |
| 405 | } |
| 406 | |
| 407 | if (!Number.isFinite(entry.size) || entry.size < 0) { |
| 408 | continue; |
| 409 | } |
| 410 | |
| 411 | candidates.push({ path: relativePath, size: entry.size }); |
| 412 | } |
| 413 | |
| 414 | return sortRemoteSplatCandidates(candidates); |
| 415 | } |
| 416 | |
| 417 | export function getPreferredHuggingFaceSplatPath( |
| 418 | entries: readonly HuggingFaceDatasetTreeEntry[], |
no test coverage detected