Skip to content

Commit 1d2add6

Browse files
committed
Revert "Merge pull request #240 from docker/make-model-optional-in-tooling"
This reverts commit 5435e65, reversing changes made to d528460.
1 parent 1f7eb6d commit 1d2add6

File tree

16 files changed

+38
-307
lines changed

16 files changed

+38
-307
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ vendor/
1515
# model-distribution
1616
pkg/distribution/bin/
1717
/parallelget
18-
/cli

cmd/cli/commands/configure.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55

66
"github.com/docker/model-runner/cmd/cli/commands/completion"
7-
"github.com/docker/model-runner/pkg/inference/models"
87
"github.com/docker/model-runner/pkg/inference/scheduling"
98
"github.com/spf13/cobra"
109
)
@@ -35,7 +34,7 @@ func newConfigureCmd() *cobra.Command {
3534
argsBeforeDash)
3635
}
3736
}
38-
opts.Model = models.NormalizeModelName(args[0])
37+
opts.Model = args[0]
3938
opts.RuntimeFlags = args[1:]
4039
return nil
4140
},

cmd/cli/commands/inspect.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"github.com/docker/model-runner/cmd/cli/commands/completion"
77
"github.com/docker/model-runner/cmd/cli/commands/formatter"
88
"github.com/docker/model-runner/cmd/cli/desktop"
9-
"github.com/docker/model-runner/pkg/inference/models"
109
"github.com/spf13/cobra"
1110
)
1211

@@ -48,8 +47,7 @@ func newInspectCmd() *cobra.Command {
4847
}
4948

5049
func inspectModel(args []string, openai bool, remote bool, desktopClient *desktop.Client) (string, error) {
51-
// Normalize model name to add default org and tag if missing
52-
modelName := models.NormalizeModelName(args[0])
50+
modelName := args[0]
5351
if openai {
5452
model, err := desktopClient.InspectOpenAI(modelName)
5553
if err != nil {

cmd/cli/commands/list.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"fmt"
66
"os"
7+
"slices"
78
"strings"
89
"time"
910

@@ -88,20 +89,12 @@ func listModels(openai bool, backend string, desktopClient *desktop.Client, quie
8889
}
8990

9091
if modelFilter != "" {
91-
// Normalize the filter to match stored model names
92-
normalizedFilter := dmrm.NormalizeModelName(modelFilter)
9392
var filteredModels []dmrm.Model
9493
for _, m := range models {
9594
hasMatchingTag := false
9695
for _, tag := range m.Tags {
97-
if tag == normalizedFilter {
98-
hasMatchingTag = true
99-
break
100-
}
101-
// Also check without the tag part
10296
modelName, _, _ := strings.Cut(tag, ":")
103-
filterName, _, _ := strings.Cut(normalizedFilter, ":")
104-
if modelName == filterName {
97+
if slices.Contains([]string{modelName, tag + ":latest", tag}, modelFilter) {
10598
hasMatchingTag = true
10699
break
107100
}
@@ -172,10 +165,8 @@ func appendRow(table *tablewriter.Table, tag string, model dmrm.Model) {
172165
fmt.Fprintf(os.Stderr, "invalid model ID for model: %v\n", model)
173166
return
174167
}
175-
// Strip default "ai/" prefix and ":latest" tag for display
176-
displayTag := stripDefaultsFromModelName(tag)
177168
table.Append([]string{
178-
displayTag,
169+
tag,
179170
model.Config.Parameters,
180171
model.Config.Quantization,
181172
model.Config.Architecture,

cmd/cli/commands/ps.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ func psTable(ps []desktop.BackendStatus) string {
5454
modelName := status.ModelName
5555
if strings.HasPrefix(modelName, "sha256:") {
5656
modelName = modelName[7:19]
57-
} else {
58-
// Strip default "ai/" prefix and ":latest" tag for display
59-
modelName = stripDefaultsFromModelName(modelName)
6057
}
6158
table.Append([]string{
6259
modelName,

cmd/cli/commands/pull.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/docker/model-runner/cmd/cli/commands/completion"
88
"github.com/docker/model-runner/cmd/cli/desktop"
9-
"github.com/docker/model-runner/pkg/inference/models"
109
"github.com/mattn/go-isatty"
1110
"github.com/spf13/cobra"
1211
)
@@ -42,8 +41,6 @@ func newPullCmd() *cobra.Command {
4241
}
4342

4443
func pullModel(cmd *cobra.Command, desktopClient *desktop.Client, model string, ignoreRuntimeMemoryCheck bool) error {
45-
// Normalize model name to add default org and tag if missing
46-
model = models.NormalizeModelName(model)
4744
var progress func(string)
4845
if isatty.IsTerminal(os.Stdout.Fd()) {
4946
progress = TUIProgress

cmd/cli/commands/push.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/docker/model-runner/cmd/cli/commands/completion"
77
"github.com/docker/model-runner/cmd/cli/desktop"
8-
"github.com/docker/model-runner/pkg/inference/models"
98
"github.com/spf13/cobra"
109
)
1110

@@ -35,8 +34,6 @@ func newPushCmd() *cobra.Command {
3534
}
3635

3736
func pushModel(cmd *cobra.Command, desktopClient *desktop.Client, model string) error {
38-
// Normalize model name to add default org and tag if missing
39-
model = models.NormalizeModelName(model)
4037
response, progressShown, err := desktopClient.Push(model, TUIProgress)
4138

4239
// Add a newline before any output (success or error) if progress was shown.

cmd/cli/commands/rm.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55

66
"github.com/docker/model-runner/cmd/cli/commands/completion"
7-
"github.com/docker/model-runner/pkg/inference/models"
87
"github.com/spf13/cobra"
98
)
109

@@ -28,12 +27,7 @@ func newRemoveCmd() *cobra.Command {
2827
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), cmd); err != nil {
2928
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
3029
}
31-
// Normalize model names to add default org and tag if missing
32-
normalizedArgs := make([]string, len(args))
33-
for i, arg := range args {
34-
normalizedArgs[i] = models.NormalizeModelName(arg)
35-
}
36-
response, err := desktopClient.Remove(normalizedArgs, force)
30+
response, err := desktopClient.Remove(args, force)
3731
if response != "" {
3832
cmd.Print(response)
3933
}

cmd/cli/commands/run.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/docker/model-runner/cmd/cli/commands/completion"
1616
"github.com/docker/model-runner/cmd/cli/desktop"
1717
"github.com/docker/model-runner/cmd/cli/readline"
18-
"github.com/docker/model-runner/pkg/inference/models"
1918
"github.com/fatih/color"
2019
"github.com/spf13/cobra"
2120
"golang.org/x/term"
@@ -562,8 +561,7 @@ func newRunCmd() *cobra.Command {
562561
return err
563562
}
564563

565-
// Normalize model name to add default org and tag if missing
566-
model := models.NormalizeModelName(args[0])
564+
model := args[0]
567565
prompt := ""
568566
argsLen := len(args)
569567
if argsLen > 1 {

cmd/cli/commands/tag.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/docker/model-runner/cmd/cli/commands/completion"
88
"github.com/docker/model-runner/cmd/cli/desktop"
9-
"github.com/docker/model-runner/pkg/inference/models"
109
"github.com/google/go-containerregistry/pkg/name"
1110
"github.com/spf13/cobra"
1211
)
@@ -37,8 +36,6 @@ func newTagCmd() *cobra.Command {
3736
}
3837

3938
func tagModel(cmd *cobra.Command, desktopClient *desktop.Client, source, target string) error {
40-
// Normalize source model name to add default org and tag if missing
41-
source = models.NormalizeModelName(source)
4239
// Ensure tag is valid
4340
tag, err := name.NewTag(target)
4441
if err != nil {

0 commit comments

Comments
 (0)