Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cli/commands/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func downloadModelsOnlyIfNotFound(desktopClient *desktop.Client, models []string
printer := desktop.NewSimplePrinter(func(s string) {
_ = sendInfo(s)
})
_, _, err = desktopClient.Pull(model, false, printer)
_, _, err = desktopClient.Pull(model, printer)
if err != nil {
_ = sendErrorf("Failed to pull model: %v", err)
return fmt.Errorf("Failed to pull model: %w\n", err)
Expand Down
20 changes: 10 additions & 10 deletions cmd/cli/commands/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestIntegration_PullModel(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
// Pull the model using the test case reference
t.Logf("Pulling model with reference: %s", tc.ref)
err := pullModel(newPullCmd(), env.client, tc.ref, true)
err := pullModel(newPullCmd(), env.client, tc.ref)
require.NoError(t, err, "Failed to pull model with reference: %s", tc.ref)

// List models and verify the expected model is present
Expand Down Expand Up @@ -426,7 +426,7 @@ func TestIntegration_InspectModel(t *testing.T) {
// Pull the model using a short reference
pullRef := "inspect-test"
t.Logf("Pulling model with reference: %s", pullRef)
err = pullModel(newPullCmd(), env.client, pullRef, true)
err = pullModel(newPullCmd(), env.client, pullRef)
require.NoError(t, err, "Failed to pull model")

// Verify the model was pulled
Expand Down Expand Up @@ -485,7 +485,7 @@ func TestIntegration_TagModel(t *testing.T) {
// Pull the model using a simple reference
pullRef := "tag-test"
t.Logf("Pulling model with reference: %s", pullRef)
err = pullModel(newPullCmd(), env.client, pullRef, true)
err = pullModel(newPullCmd(), env.client, pullRef)
require.NoError(t, err, "Failed to pull model")

// Verify the model was pulled
Expand Down Expand Up @@ -663,7 +663,7 @@ func TestIntegration_PushModel(t *testing.T) {
// Pull the model using a simple reference
pullRef := "tag-test"
t.Logf("Pulling model with reference: %s", pullRef)
err = pullModel(newPullCmd(), env.client, pullRef, true)
err = pullModel(newPullCmd(), env.client, pullRef)
require.NoError(t, err, "Failed to pull model")

// Verify the model was pulled
Expand Down Expand Up @@ -814,7 +814,7 @@ func TestIntegration_RemoveModel(t *testing.T) {
// Pull the model
pullRef := "rm-test"
t.Logf("Pulling model with reference: %s", pullRef)
err := pullModel(newPullCmd(), env.client, pullRef, true)
err := pullModel(newPullCmd(), env.client, pullRef)
require.NoError(t, err, "Failed to pull model")

// Verify model exists
Expand Down Expand Up @@ -848,11 +848,11 @@ func TestIntegration_RemoveModel(t *testing.T) {

// Pull both models
t.Logf("Pulling first model: rm-multi-1")
err := pullModel(newPullCmd(), env.client, "rm-multi-1", true)
err := pullModel(newPullCmd(), env.client, "rm-multi-1")
require.NoError(t, err, "Failed to pull first model")

t.Logf("Pulling second model: rm-multi-2")
err = pullModel(newPullCmd(), env.client, "rm-multi-2", true)
err = pullModel(newPullCmd(), env.client, "rm-multi-2")
require.NoError(t, err, "Failed to pull second model")

// Verify both models exist
Expand All @@ -878,7 +878,7 @@ func TestIntegration_RemoveModel(t *testing.T) {
t.Run("remove specific tag keeps other tags", func(t *testing.T) {
// Pull the model
t.Logf("Pulling model: rm-test")
err := pullModel(newPullCmd(), env.client, "rm-test", true)
err := pullModel(newPullCmd(), env.client, "rm-test")
require.NoError(t, err, "Failed to pull model")

// Add multiple tags to the same model
Expand Down Expand Up @@ -940,7 +940,7 @@ func TestIntegration_RemoveModel(t *testing.T) {
t.Run("remove by model ID removes all tags", func(t *testing.T) {
// Pull the model
t.Logf("Pulling model: rm-test")
err := pullModel(newPullCmd(), env.client, "rm-test", true)
err := pullModel(newPullCmd(), env.client, "rm-test")
require.NoError(t, err, "Failed to pull model")

// Add multiple tags
Expand Down Expand Up @@ -971,7 +971,7 @@ func TestIntegration_RemoveModel(t *testing.T) {
t.Run("force flag", func(t *testing.T) {
// Pull the model
t.Logf("Pulling model: rm-test")
err := pullModel(newPullCmd(), env.client, "rm-test", true)
err := pullModel(newPullCmd(), env.client, "rm-test")
require.NoError(t, err, "Failed to pull model")

// Test removal with force flag
Expand Down
10 changes: 3 additions & 7 deletions cmd/cli/commands/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
)

func newPullCmd() *cobra.Command {
var ignoreRuntimeMemoryCheck bool

c := &cobra.Command{
Use: "pull MODEL",
Short: "Pull a model from Docker Hub or HuggingFace to your local environment",
Expand All @@ -20,19 +18,17 @@ func newPullCmd() *cobra.Command {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
return pullModel(cmd, desktopClient, args[0], ignoreRuntimeMemoryCheck)
return pullModel(cmd, desktopClient, args[0])
},
ValidArgsFunction: completion.NoComplete,
}

c.Flags().BoolVar(&ignoreRuntimeMemoryCheck, "ignore-runtime-memory-check", false, "Do not block pull if estimated runtime memory for model exceeds system resources.")

return c
}

func pullModel(cmd *cobra.Command, desktopClient *desktop.Client, model string, ignoreRuntimeMemoryCheck bool) error {
func pullModel(cmd *cobra.Command, desktopClient *desktop.Client, model string) error {
printer := asPrinter(cmd)
response, _, err := desktopClient.Pull(model, ignoreRuntimeMemoryCheck, printer)
response, _, err := desktopClient.Pull(model, printer)

if err != nil {
return handleClientError(err, "Failed to pull model")
Expand Down
4 changes: 1 addition & 3 deletions cmd/cli/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ func chatWithMarkdownContext(ctx context.Context, cmd *cobra.Command, client *de

func newRunCmd() *cobra.Command {
var debug bool
var ignoreRuntimeMemoryCheck bool
var colorMode string
var detach bool

Expand Down Expand Up @@ -686,7 +685,7 @@ func newRunCmd() *cobra.Command {
return handleClientError(err, "Failed to inspect model")
}
cmd.Println("Unable to find model '" + model + "' locally. Pulling from the server.")
if err := pullModel(cmd, desktopClient, model, ignoreRuntimeMemoryCheck); err != nil {
if err := pullModel(cmd, desktopClient, model); err != nil {
return err
}
}
Expand Down Expand Up @@ -733,7 +732,6 @@ func newRunCmd() *cobra.Command {
c.Args = requireMinArgs(1, "run", cmdArgs)

c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
c.Flags().BoolVar(&ignoreRuntimeMemoryCheck, "ignore-runtime-memory-check", false, "Do not block pull if estimated runtime memory for model exceeds system resources.")
c.Flags().StringVar(&colorMode, "color", "no", "Use colored output (auto|yes|no)")
c.Flags().BoolVarP(&detach, "detach", "d", false, "Load the model in the background without interaction")

Expand Down
7 changes: 3 additions & 4 deletions cmd/cli/desktop/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *Client) Status() Status {
}
}

func (c *Client) Pull(model string, ignoreRuntimeMemoryCheck bool, printer standalone.StatusPrinter) (string, bool, error) {
func (c *Client) Pull(model string, printer standalone.StatusPrinter) (string, bool, error) {
model = normalizeHuggingFaceModelName(model)

// Check if this is a Hugging Face model and if HF_TOKEN is set
Expand All @@ -116,9 +116,8 @@ func (c *Client) Pull(model string, ignoreRuntimeMemoryCheck bool, printer stand

return c.withRetries("download", 3, printer, func(attempt int) (string, bool, error, bool) {
jsonData, err := json.Marshal(dmrm.ModelCreateRequest{
From: model,
IgnoreRuntimeMemoryCheck: ignoreRuntimeMemoryCheck,
BearerToken: hfToken,
From: model,
BearerToken: hfToken,
})
if err != nil {
// Marshaling errors are not retryable
Expand Down
14 changes: 7 additions & 7 deletions cmd/cli/desktop/desktop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestPullHuggingFaceModel(t *testing.T) {
}, nil)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.NoError(t, err)
}

Expand Down Expand Up @@ -126,7 +126,7 @@ func TestNonHuggingFaceModel(t *testing.T) {
}, nil)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.NoError(t, err)
}

Expand Down Expand Up @@ -250,7 +250,7 @@ func TestPullRetryOnNetworkError(t *testing.T) {
)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.NoError(t, err)
}

Expand All @@ -270,7 +270,7 @@ func TestPullNoRetryOn4xxError(t *testing.T) {
}, nil).Times(1)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.Error(t, err)
assert.Contains(t, err.Error(), "Model not found")
}
Expand All @@ -297,7 +297,7 @@ func TestPullRetryOn5xxError(t *testing.T) {
)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.NoError(t, err)
}

Expand All @@ -324,7 +324,7 @@ func TestPullRetryOnServiceUnavailable(t *testing.T) {
)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.NoError(t, err)
}

Expand All @@ -341,7 +341,7 @@ func TestPullMaxRetriesExhausted(t *testing.T) {
mockClient.EXPECT().Do(gomock.Any()).Return(nil, io.EOF).Times(4)

printer := NewSimplePrinter(func(s string) {})
_, _, err := client.Pull(modelName, false, printer)
_, _, err := client.Pull(modelName, printer)
assert.Error(t, err)
assert.Contains(t, err.Error(), "failed to download after 3 retries")
}
Expand Down
12 changes: 0 additions & 12 deletions cmd/cli/docs/reference/docker_model_pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@ long: |
usage: docker model pull MODEL
pname: docker model
plink: docker_model.yaml
options:
- option: ignore-runtime-memory-check
value_type: bool
default_value: "false"
description: |
Do not block pull if estimated runtime memory for model exceeds system resources.
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### Pulling a model from Docker Hub

Expand Down
11 changes: 0 additions & 11 deletions cmd/cli/docs/reference/docker_model_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: ignore-runtime-memory-check
value_type: bool
default_value: "false"
description: |
Do not block pull if estimated runtime memory for model exceeds system resources.
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
examples: |-
### One-time prompt

Expand Down
6 changes: 0 additions & 6 deletions cmd/cli/docs/reference/model_pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
<!---MARKER_GEN_START-->
Pull a model from Docker Hub or HuggingFace to your local environment

### Options

| Name | Type | Default | Description |
|:--------------------------------|:-------|:--------|:----------------------------------------------------------------------------------|
| `--ignore-runtime-memory-check` | `bool` | | Do not block pull if estimated runtime memory for model exceeds system resources. |


<!---MARKER_GEN_END-->

Expand Down
11 changes: 5 additions & 6 deletions cmd/cli/docs/reference/model_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ Run a model and interact with it using a submitted prompt or chat mode

### Options

| Name | Type | Default | Description |
|:--------------------------------|:---------|:--------|:----------------------------------------------------------------------------------|
| `--color` | `string` | `no` | Use colored output (auto\|yes\|no) |
| `--debug` | `bool` | | Enable debug logging |
| `-d`, `--detach` | `bool` | | Load the model in the background without interaction |
| `--ignore-runtime-memory-check` | `bool` | | Do not block pull if estimated runtime memory for model exceeds system resources. |
| Name | Type | Default | Description |
|:-----------------|:---------|:--------|:-----------------------------------------------------|
| `--color` | `string` | `no` | Use colored output (auto\|yes\|no) |
| `--debug` | `bool` | | Enable debug logging |
| `-d`, `--detach` | `bool` | | Load the model in the background without interaction |


<!---MARKER_GEN_END-->
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/containerd/platforms v1.0.0-rc.1
github.com/docker/go-units v0.5.0
github.com/docker/model-runner/pkg/go-containerregistry v0.0.0-20251121150728-6951a2a36575
github.com/elastic/go-sysinfo v1.15.4
github.com/gpustack/gguf-parser-go v0.22.1
github.com/jaypipes/ghw v0.19.1
github.com/kolesnikovae/go-winjob v1.0.0
Expand All @@ -30,7 +29,6 @@ require (
github.com/docker/cli v28.3.0+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.9.3 // indirect
github.com/elastic/go-windows v1.0.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand All @@ -47,7 +45,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/smallnest/ringbuffer v0.0.0-20241116012123-461381446e3d // indirect
github.com/vbatts/tar-split v0.12.1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ github.com/docker/go-winjob v0.0.0-20250829235554-57b487ebcbc5 h1:dxSFEb0EEmvceI
github.com/docker/go-winjob v0.0.0-20250829235554-57b487ebcbc5/go.mod h1:ICOGmIXdwhfid7rQP+tLvDJqVg0lHdEk3pI5nsapTtg=
github.com/docker/model-runner/pkg/go-containerregistry v0.0.0-20251121150728-6951a2a36575 h1:N2yLWYSZFTVLkLTh8ux1Z0Nug/F78pXsl2KDtbWhe+Y=
github.com/docker/model-runner/pkg/go-containerregistry v0.0.0-20251121150728-6951a2a36575/go.mod h1:gbdiY0X8gr0J88OfUuRD29JXCWT9jgHzPmrqTlO15BM=
github.com/elastic/go-sysinfo v1.15.4 h1:A3zQcunCxik14MgXu39cXFXcIw2sFXZ0zL886eyiv1Q=
github.com/elastic/go-sysinfo v1.15.4/go.mod h1:ZBVXmqS368dOn/jvijV/zHLfakWTYHBZPk3G244lHrU=
github.com/elastic/go-windows v1.0.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI=
github.com/elastic/go-windows v1.0.2/go.mod h1:bGcDpBzXgYSqM0Gx3DM4+UxFj300SZLixie9u9ixLM8=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
Expand Down Expand Up @@ -112,17 +108,13 @@ github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNw
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc=
github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smallnest/ringbuffer v0.0.0-20241116012123-461381446e3d h1:3VwvTjiRPA7cqtgOWddEL+JrcijMlXUmj99c/6YyZoY=
github.com/smallnest/ringbuffer v0.0.0-20241116012123-461381446e3d/go.mod h1:tAG61zBM1DYRaGIPloumExGvScf08oHuo0kFoOqdbT0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
Expand Down
Loading
Loading