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 @@ -51,7 +51,7 @@ func newUpCommand() *cobra.Command {

sendInfo("Initializing model runner...")
kind := modelRunner.EngineKind()
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), nil)
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), nil, false)
if err != nil {
_ = sendErrorf("Failed to initialize standalone model runner: %v", err)
return fmt.Errorf("Failed to initialize standalone model runner: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func newInspectCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
if openai && remote {
Expand Down
12 changes: 7 additions & 5 deletions cmd/cli/commands/install-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func inspectStandaloneRunner(container container.Summary) *standaloneRunner {
// ensureStandaloneRunnerAvailable is a utility function that other commands can
// use to initialize a default standalone model runner. It is a no-op in
// unsupported contexts or if automatic installs have been disabled.
func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.StatusPrinter) (*standaloneRunner, error) {
func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.StatusPrinter, debug bool) (*standaloneRunner, error) {
// If we're not in a supported model runner context, then don't do anything.
engineKind := modelRunner.EngineKind()
standaloneSupported := engineKind == types.ModelRunnerEngineKindMoby ||
Expand Down Expand Up @@ -138,7 +138,7 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
port = standalone.DefaultControllerPortCloud
environment = "cloud"
}
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind); err != nil {
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind, debug); err != nil {
return nil, fmt.Errorf("unable to initialize standalone model runner container: %w", err)
}

Expand Down Expand Up @@ -175,7 +175,7 @@ type runnerOptions struct {
}

// runInstallOrStart is shared logic for install-runner and start-runner commands
func runInstallOrStart(cmd *cobra.Command, opts runnerOptions) error {
func runInstallOrStart(cmd *cobra.Command, opts runnerOptions, debug bool) error {
// Ensure that we're running in a supported model runner context.
engineKind := modelRunner.EngineKind()
if engineKind == types.ModelRunnerEngineKindDesktop {
Expand Down Expand Up @@ -282,7 +282,7 @@ func runInstallOrStart(cmd *cobra.Command, opts runnerOptions) error {
return fmt.Errorf("unable to initialize standalone model storage: %w", err)
}
// Create the model runner container.
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind); err != nil {
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind, debug); err != nil {
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
}

Expand All @@ -296,6 +296,7 @@ func newInstallRunner() *cobra.Command {
var gpuMode string
var backend string
var doNotTrack bool
var debug bool
c := &cobra.Command{
Use: "install-runner",
Short: "Install Docker Model Runner (Docker Engine only)",
Expand All @@ -308,7 +309,7 @@ func newInstallRunner() *cobra.Command {
doNotTrack: doNotTrack,
pullImage: true,
pruneContainers: false,
})
}, debug)
},
ValidArgsFunction: completion.NoComplete,
}
Expand All @@ -318,5 +319,6 @@ func newInstallRunner() *cobra.Command {
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|rocm|musa|cann)")
c.Flags().StringVar(&backend, "backend", "", backendUsage)
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
return c
}
2 changes: 1 addition & 1 deletion cmd/cli/commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func newListCmd() *cobra.Command {
if !jsonFormat && !openai && !quiet {
standaloneInstallPrinter = asPrinter(cmd)
}
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), standaloneInstallPrinter); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), standaloneInstallPrinter, false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
var modelFilter string
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/commands/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func newPullCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
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)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/commands/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func newPushCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
return pushModel(cmd, desktopClient, args[0])
Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/commands/reinstall-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func newReinstallRunner() *cobra.Command {
var gpuMode string
var backend string
var doNotTrack bool
var debug bool
c := &cobra.Command{
Use: "reinstall-runner",
Short: "Reinstall Docker Model Runner (Docker Engine only)",
Expand All @@ -23,7 +24,7 @@ func newReinstallRunner() *cobra.Command {
doNotTrack: doNotTrack,
pullImage: true,
pruneContainers: true,
})
}, debug)
},
ValidArgsFunction: completion.NoComplete,
}
Expand All @@ -33,5 +34,6 @@ func newReinstallRunner() *cobra.Command {
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|musa|rocm|cann)")
c.Flags().StringVar(&backend, "backend", "", backendUsage)
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
return c
}
2 changes: 1 addition & 1 deletion cmd/cli/commands/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func newRequestsCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/commands/restart-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func newRestartRunner() *cobra.Command {
var host string
var gpuMode string
var doNotTrack bool
var debug bool
c := &cobra.Command{
Use: "restart-runner",
Short: "Restart Docker Model Runner (Docker Engine only)",
Expand All @@ -29,7 +30,7 @@ func newRestartRunner() *cobra.Command {
gpuMode: gpuMode,
doNotTrack: doNotTrack,
pullImage: false,
})
}, debug)
},
ValidArgsFunction: completion.NoComplete,
}
Expand All @@ -38,5 +39,6 @@ func newRestartRunner() *cobra.Command {
c.Flags().StringVar(&host, "host", "127.0.0.1", "Host address to bind Docker Model Runner")
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|musa|rocm|cann)")
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
return c
}
2 changes: 1 addition & 1 deletion cmd/cli/commands/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func newRemoveCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
response, err := desktopClient.Remove(args, force)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ func newRunCmd() *cobra.Command {
return nil
}

if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), debug); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/cli/commands/start-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func newStartRunner() *cobra.Command {
var gpuMode string
var backend string
var doNotTrack bool
var debug bool
c := &cobra.Command{
Use: "start-runner",
Short: "Start Docker Model Runner (Docker Engine only)",
Expand All @@ -20,7 +21,7 @@ func newStartRunner() *cobra.Command {
backend: backend,
doNotTrack: doNotTrack,
pullImage: false,
})
}, debug)
},
ValidArgsFunction: completion.NoComplete,
}
Expand All @@ -29,5 +30,6 @@ func newStartRunner() *cobra.Command {
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|musa|rocm|cann)")
c.Flags().StringVar(&backend, "backend", "", backendUsage)
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
return c
}
2 changes: 1 addition & 1 deletion cmd/cli/commands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func newStatusCmd() *cobra.Command {
Use: "status",
Short: "Check if the Docker Model Runner is running",
RunE: func(cmd *cobra.Command, args []string) error {
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd))
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false)
if err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/commands/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newTagCmd() *cobra.Command {
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
}
return tagModel(cmd, desktopClient, args[0], args[1])
Expand Down
10 changes: 10 additions & 0 deletions cmd/cli/docs/reference/docker_model_install-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: debug
value_type: bool
default_value: "false"
description: Enable debug logging
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: do-not-track
value_type: bool
default_value: "false"
Expand Down
10 changes: 10 additions & 0 deletions cmd/cli/docs/reference/docker_model_reinstall-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: debug
value_type: bool
default_value: "false"
description: Enable debug logging
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: do-not-track
value_type: bool
default_value: "false"
Expand Down
10 changes: 10 additions & 0 deletions cmd/cli/docs/reference/docker_model_restart-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ usage: docker model restart-runner
pname: docker model
plink: docker_model.yaml
options:
- option: debug
value_type: bool
default_value: "false"
description: Enable debug logging
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: do-not-track
value_type: bool
default_value: "false"
Expand Down
10 changes: 10 additions & 0 deletions cmd/cli/docs/reference/docker_model_start-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: debug
value_type: bool
default_value: "false"
description: Enable debug logging
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: do-not-track
value_type: bool
default_value: "false"
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/docs/reference/model_install-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Install Docker Model Runner (Docker Engine only)
| Name | Type | Default | Description |
|:-----------------|:---------|:------------|:-------------------------------------------------------------------------------------------------------|
| `--backend` | `string` | | Specify backend (llama.cpp\|vllm). Default: llama.cpp |
| `--debug` | `bool` | | Enable debug logging |
| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner |
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda\|rocm\|musa\|cann) |
| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner |
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/docs/reference/model_reinstall-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Reinstall Docker Model Runner (Docker Engine only)
| Name | Type | Default | Description |
|:-----------------|:---------|:------------|:-------------------------------------------------------------------------------------------------------|
| `--backend` | `string` | | Specify backend (llama.cpp\|vllm). Default: llama.cpp |
| `--debug` | `bool` | | Enable debug logging |
| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner |
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda\|musa\|rocm\|cann) |
| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner |
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/docs/reference/model_restart-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Restart Docker Model Runner (Docker Engine only)

| Name | Type | Default | Description |
|:-----------------|:---------|:------------|:-------------------------------------------------------------------------------------------------------|
| `--debug` | `bool` | | Enable debug logging |
| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner |
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda\|musa\|rocm\|cann) |
| `--host` | `string` | `127.0.0.1` | Host address to bind Docker Model Runner |
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/docs/reference/model_start-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Start Docker Model Runner (Docker Engine only)
| Name | Type | Default | Description |
|:-----------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------|
| `--backend` | `string` | | Specify backend (llama.cpp\|vllm). Default: llama.cpp |
| `--debug` | `bool` | | Enable debug logging |
| `--do-not-track` | `bool` | | Do not track models usage in Docker Model Runner |
| `--gpu` | `string` | `auto` | Specify GPU support (none\|auto\|cuda\|musa\|rocm\|cann) |
| `--port` | `uint16` | `0` | Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode) |
Expand Down
8 changes: 4 additions & 4 deletions cmd/cli/pkg/standalone/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func isRootless(ctx context.Context, dockerClient *client.Client) bool {
}

// Check whether the host Ascend driver path exists. If so, create the corresponding mount configuration.
func tryGetBindAscendMounts(printer StatusPrinter) []mount.Mount {
func tryGetBindAscendMounts(printer StatusPrinter, debug bool) []mount.Mount {
hostPaths := []string{
"/usr/local/dcmi",
"/usr/local/bin/npu-smi",
Expand All @@ -258,7 +258,7 @@ func tryGetBindAscendMounts(printer StatusPrinter) []mount.Mount {
}
newMounts = append(newMounts, newMount)
} else {
if os.Getenv("DEBUG") == "1" {
if debug {
printer.Printf("[NOT FOUND] Ascend driver path does not exist, skipping: %s\n", hostPath)
}
}
Expand All @@ -268,7 +268,7 @@ func tryGetBindAscendMounts(printer StatusPrinter) []mount.Mount {
}

// CreateControllerContainer creates and starts a controller container.
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, host string, environment string, doNotTrack bool, gpu gpupkg.GPUSupport, backend string, modelStorageVolume string, printer StatusPrinter, engineKind types.ModelRunnerEngineKind) error {
func CreateControllerContainer(ctx context.Context, dockerClient *client.Client, port uint16, host string, environment string, doNotTrack bool, gpu gpupkg.GPUSupport, backend string, modelStorageVolume string, printer StatusPrinter, engineKind types.ModelRunnerEngineKind, debug bool) error {
imageName := controllerImageName(gpu, backend)

// Set up the container configuration.
Expand Down Expand Up @@ -311,7 +311,7 @@ func CreateControllerContainer(ctx context.Context, dockerClient *client.Client,
Name: "always",
},
}
ascendMounts := tryGetBindAscendMounts(printer)
ascendMounts := tryGetBindAscendMounts(printer, debug)
if len(ascendMounts) > 0 {
hostConfig.Mounts = append(hostConfig.Mounts, ascendMounts...)
}
Expand Down
Loading