Skip to content

models list: stop truncating ids - #19

Open
andredezzy wants to merge 1 commit into
digimata:masterfrom
andredezzy:fix/models-list-truncation
Open

models list: stop truncating ids#19
andredezzy wants to merge 1 commit into
digimata:masterfrom
andredezzy:fix/models-list-truncation

Conversation

@andredezzy

Copy link
Copy Markdown

Problem

models list pads the id column with padding(toLength: 26, …), and Swift's
padding(toLength:) truncates when the string is longer than the target. Any
id past 26 characters is printed cut off, and a cut id cannot be pasted into
parrot models download.

Reproducible with any longer id. Adding a 33-character one to the registry:

  whisper-large-v3-turbo-com   632 MB  [multi]    Whisper Large v3 Turbo (compressed)

The command's whole purpose is to give the user a value to copy, so silently
corrupting it defeats the feature.

Fix

Size the column to the longest id in the registry instead of a fixed 26. Output
with the same registry:

★ whisper-base.en                     145 MB  [en]       Whisper Base (English)
  whisper-large-v3-turbo             1620 MB  [multi]    Whisper Large v3 Turbo
  whisper-large-v3-turbo-compressed   632 MB  [multi]    Whisper Large v3 Turbo (compressed)
  whisper-small.en                    488 MB  [en]       Whisper Small (English)

Current ids all fit in 26 characters, so nothing changes for them today — this
only stops the next longer id from being mangled.

Built locally with swift build -c release (no PR CI in this repo); clean, no
warnings.

`padding(toLength:)` truncates when the string is longer than the target, so any
id past 26 characters was printed cut off — and a cut id cannot be pasted into
`parrot models download`. Size the column to the longest id instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant