Sfoglia il codice sorgente

x/model: preserve build casing

Blake Mizerany 1 anno fa
parent
commit
3cb07b3ac9
2 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 1 1
      x/model/name.go
  2. 4 1
      x/model/name_test.go

+ 1 - 1
x/model/name.go

@@ -134,7 +134,7 @@ func ParseName(s string) Name {
 		case Tag:
 			r.tag = part
 		case Build:
-			r.build = strings.ToUpper(part)
+			r.build = part
 		case Invalid:
 			return Name{}
 		}

+ 4 - 1
x/model/name_test.go

@@ -15,12 +15,15 @@ var testNames = map[string]Name{
 	"mistral:7b+Q4_0":                {model: "mistral", tag: "7b", build: "Q4_0"},
 	"mistral+KQED":                   {model: "mistral", build: "KQED"},
 	"mistral.x-3:7b+Q4_0":            {model: "mistral.x-3", tag: "7b", build: "Q4_0"},
-	"mistral:7b+q4_0":                {model: "mistral", tag: "7b", build: "Q4_0"},
+	"mistral:7b+q4_0":                {model: "mistral", tag: "7b", build: "q4_0"},
 	"llama2":                         {model: "llama2"},
 	"user/model":                     {namespace: "user", model: "model"},
 	"example.com/ns/mistral:7b+Q4_0": {host: "example.com", namespace: "ns", model: "mistral", tag: "7b", build: "Q4_0"},
 	"example.com/ns/mistral:7b+x":    {host: "example.com", namespace: "ns", model: "mistral", tag: "7b", build: "X"},
 
+	// preserves case for build
+	"x+b": {model: "x", build: "b"},
+
 	// invalid (includes fuzzing trophies)
 	" / / : + ": {},
 	" / : + ":   {},