Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Comments

run: Ensure model name/tag only if it's not pulled#37

Merged
doringeman merged 1 commit intodocker:mainfrom
doringeman:fix-model-run-panic
Apr 25, 2025
Merged

run: Ensure model name/tag only if it's not pulled#37
doringeman merged 1 commit intodocker:mainfrom
doringeman:fix-model-run-panic

Conversation

@doringeman
Copy link
Collaborator

Running a model which has to be pulled will result in a panic.
Without this patch:

$ docker model run ghcr.io/ilopezluna/smollm2 'hi'
Unable to find model 'ghcr.io/ilopezluna/smollm2' locally. Pulling from the server.
Downloaded: 83.75 MB
Model pulled successfully
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/docker/model-cli/commands.newRunCmd.func1(0x140000ffb08, {0x140000d67c0?, 0x0?, 0xb7117dd000000000?})
	/Users/doringeman/workspace/model-cli/commands/run.go:46 +0x61c

Signed-off-by: Dorin Geman <dorin.geman@docker.com>
@doringeman doringeman requested a review from glours April 25, 2025 10:33
Copy link
Member

@kiview kiview left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Eventually we should transition into a development pace, that submits such fixes together with their tests 😉

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
}
if model != modelDetail.Tags[0] {
} else if model != modelDetail.Tags[0] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if pullModel function should not return a Model struct, so you can update modelDetail 🤔
Anyway it can be done in a follow up PR

@doringeman doringeman merged commit 7ce2cae into docker:main Apr 25, 2025
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants