From 90cab4afb5e8107907b3f4a1934d70f2acb4671e Mon Sep 17 00:00:00 2001 From: Jacob Gillespie Date: Mon, 6 Jan 2025 20:37:19 +0000 Subject: [PATCH 1/3] Normalize image name --- models/top.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/top.ts b/models/top.ts index e3b482a..90e5b53 100644 --- a/models/top.ts +++ b/models/top.ts @@ -12,7 +12,7 @@ async function getTopHuggingFaceModels(topN: number): Promise { } const data: HuggingFaceModel[] = await response.json() - return data.map(({id, sha}) => ({name: id.toLowerCase(), sha, tagAs: 'latest'})) + return data.map(({id, sha}) => ({name: id.toLowerCase().replaceAll('.', '-'), sha, tagAs: 'latest'})) } async function main() { From 359a5de69edd09eda152ef27177473fb55b5f4e4 Mon Sep 17 00:00:00 2001 From: Jacob Gillespie Date: Mon, 6 Jan 2025 20:39:19 +0000 Subject: [PATCH 2/3] Fix name during build --- bin/build-and-push-model | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/build-and-push-model b/bin/build-and-push-model index 670bf66..cff18e5 100755 --- a/bin/build-and-push-model +++ b/bin/build-and-push-model @@ -14,12 +14,14 @@ tag=${3:-latest} annotations="annotation.org.opencontainers.image.revision=${sha},annotation.org.opencontainers.image.source=https://huggingface.co/${name},annotation-index.org.opencontainers.image.revision=${sha},annotation-index.org.opencontainers.image.source=https://huggingface.co/${name},annotation-manifest-descriptor.org.opencontainers.image.revision=${sha},annotation-manifest-descriptor.org.opencontainers.image.source=https://huggingface.co/${name}" +normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr '.' '-')" + depot build . \ -f "${SCRIPT_DIR}/../models/Dockerfile" \ --platform linux/amd64,linux/arm64 \ --build-arg "MODEL=${name}" \ --build-arg "SHA=${sha}" \ --build-arg "SOURCE_DATE_EPOCH=0" \ - --output "type=image,name=us-docker.pkg.dev/depot-gcp/depot-ai/$(echo "$name" | tr '[:upper:]' '[:lower:]'):${tag},push=true,compression=estargz,oci-mediatypes=true,force-compression=true,${annotations}" \ + --output "type=image,name=us-docker.pkg.dev/depot-gcp/depot-ai/${normalized}:${tag},push=true,compression=estargz,oci-mediatypes=true,force-compression=true,${annotations}" \ --ssh "default=${SSH_AUTH_SOCK}" \ --progress plain From fe250f566f19e45463ad757ec489bb077cf518ee Mon Sep 17 00:00:00 2001 From: Jacob Gillespie Date: Mon, 6 Jan 2025 20:44:13 +0000 Subject: [PATCH 3/3] Don't update -, lowercase on website --- bin/build-and-push-model | 2 +- models/top.ts | 2 +- website/src/components/Model.tsx | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/build-and-push-model b/bin/build-and-push-model index cff18e5..7c6359e 100755 --- a/bin/build-and-push-model +++ b/bin/build-and-push-model @@ -14,7 +14,7 @@ tag=${3:-latest} annotations="annotation.org.opencontainers.image.revision=${sha},annotation.org.opencontainers.image.source=https://huggingface.co/${name},annotation-index.org.opencontainers.image.revision=${sha},annotation-index.org.opencontainers.image.source=https://huggingface.co/${name},annotation-manifest-descriptor.org.opencontainers.image.revision=${sha},annotation-manifest-descriptor.org.opencontainers.image.source=https://huggingface.co/${name}" -normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr '.' '-')" +normalized="$(echo "$name" | tr '[:upper:]' '[:lower:]')" depot build . \ -f "${SCRIPT_DIR}/../models/Dockerfile" \ diff --git a/models/top.ts b/models/top.ts index 90e5b53..e3b482a 100644 --- a/models/top.ts +++ b/models/top.ts @@ -12,7 +12,7 @@ async function getTopHuggingFaceModels(topN: number): Promise { } const data: HuggingFaceModel[] = await response.json() - return data.map(({id, sha}) => ({name: id.toLowerCase().replaceAll('.', '-'), sha, tagAs: 'latest'})) + return data.map(({id, sha}) => ({name: id.toLowerCase(), sha, tagAs: 'latest'})) } async function main() { diff --git a/website/src/components/Model.tsx b/website/src/components/Model.tsx index 96130ed..83d4a88 100644 --- a/website/src/components/Model.tsx +++ b/website/src/components/Model.tsx @@ -1,5 +1,5 @@ import {cx} from 'class-variance-authority' -import {SVGProps, useCallback, useEffect, useState} from 'react' +import {SVGProps, useCallback, useEffect, useMemo, useState} from 'react' import {useCopyToClipboard} from '../hooks/useCopyToClipboard' export interface ModelProps { @@ -20,9 +20,11 @@ export function Model({name, sha, tagAs}: ModelProps) { return () => clearTimeout(timeout) }, [value]) + const normalizedName = useMemo(() => name.toLowerCase(), [name]) + const copyImage = useCallback(() => { - copy(`COPY --link --from=depot.ai/${name}:${tagAs} / .`) - }, [name, tagAs]) + copy(`COPY --link --from=depot.ai/${normalizedName}:${tagAs} / .`) + }, [normalizedName, tagAs]) return (
@@ -36,7 +38,7 @@ export function Model({name, sha, tagAs}: ModelProps) { />
depot.ai/ - {name} + {normalizedName} :{tagAs}