From aa7dbdc9fa701debeee28d9c7eb4af6258685321 Mon Sep 17 00:00:00 2001 From: NamH Date: Wed, 7 Aug 2024 23:05:28 +0700 Subject: [PATCH] fix: merge gpu arch and os tensorrt models (#3299) Signed-off-by: James --- web/utils/huggingface.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/web/utils/huggingface.ts b/web/utils/huggingface.ts index 1bd71dff4..ef6919534 100644 --- a/web/utils/huggingface.ts +++ b/web/utils/huggingface.ts @@ -174,11 +174,22 @@ export const getEngineAndBranches = async ( continue } if (branch.includes('tensorrt-llm')) { - const fileSize = await getFileSizeByRepoAndBranch(name, branch) - engineToBranches.tensorrtllm.push({ - name: branch, - fileSize: fileSize, - }) + const mergedBranchName = branch.split('-').slice(0, -2).join('-') + let isAlreadyAdded = false + // check if the branch is already added + for (const branch of engineToBranches.tensorrtllm) { + if (branch.name.includes(mergedBranchName)) { + isAlreadyAdded = true + break + } + } + if (!isAlreadyAdded) { + const fileSize = await getFileSizeByRepoAndBranch(name, branch) + engineToBranches.tensorrtllm.push({ + name: mergedBranchName, + fileSize: fileSize, + }) + } continue } }