Skip to content

Commit 3775fa8

Browse files
authored
feat: align with the model-spec v0.0.2 (#87)
Signed-off-by: chlins <[email protected]>
1 parent b5bcb07 commit 3775fa8

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/CloudNativeAI/modctl
33
go 1.23.3
44

55
require (
6-
github.com/CloudNativeAI/model-spec v0.0.1
6+
github.com/CloudNativeAI/model-spec v0.0.2
77
github.com/distribution/distribution/v3 v3.0.0-rc.3
88
github.com/distribution/reference v0.6.0
99
github.com/dustin/go-humanize v1.0.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/CloudNativeAI/model-spec v0.0.1 h1:BgVIStKTLuL1DrLC5A/gmHcR8TEhFCDz9+fYdCUa/CY=
2-
github.com/CloudNativeAI/model-spec v0.0.1/go.mod h1:3U/4zubBfbUkW59ATSg41HnkYyKrKUcKFH/cVdoPQnk=
1+
github.com/CloudNativeAI/model-spec v0.0.2 h1:uCO86kMk8wwadn8vKs0wT4petig5crByTIngdO3L2cQ=
2+
github.com/CloudNativeAI/model-spec v0.0.2/go.mod h1:3U/4zubBfbUkW59ATSg41HnkYyKrKUcKFH/cVdoPQnk=
33
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
44
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
55
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=

pkg/backend/build/build.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"encoding/json"
2323
"fmt"
2424
"path/filepath"
25-
"strconv"
2625
"time"
2726

2827
"github.com/CloudNativeAI/modctl/pkg/archiver"
@@ -74,13 +73,8 @@ func buildModelConfig(modelfile modelfile.Modelfile) (*modelspec.Model, error) {
7473
Format: modelfile.GetFormat(),
7574
Precision: modelfile.GetPrecision(),
7675
Quantization: modelfile.GetQuantization(),
76+
ParamSize: modelfile.GetParamsize(),
7777
}
78-
// parse the parameter size.
79-
paramSize, err := strconv.ParseUint(modelfile.GetParamsize(), 10, 64)
80-
if err != nil {
81-
return nil, fmt.Errorf("failed to parse paramsize %s to uint64: %w", modelfile.GetParamsize(), err)
82-
}
83-
config.ParameterSize = paramSize
8478

8579
createdAt := time.Now()
8680
descriptor := modelspec.ModelDescriptor{

pkg/backend/inspect.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (b *backend) Inspect(ctx context.Context, target string) (*InspectedModelAr
9999
Family: config.Descriptor.Family,
100100
Format: config.Config.Format,
101101
Name: config.Descriptor.Name,
102-
ParamSize: fmt.Sprintf("%d", config.Config.ParameterSize),
102+
ParamSize: config.Config.ParamSize,
103103
Precision: config.Config.Precision,
104104
Quantization: config.Config.Quantization,
105105
}

pkg/backend/inspect_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func TestInspect(t *testing.T) {
120120
"config": {
121121
"architecture": "transformer",
122122
"format": "tensorflow",
123-
"parameterSize": 50000000000,
123+
"paramSize": "0.5b",
124124
"precision": "int8",
125125
"puantization": "gptq"
126126
}
@@ -138,7 +138,7 @@ func TestInspect(t *testing.T) {
138138
assert.Equal(t, "qwen2", inspected.Family)
139139
assert.Equal(t, "tensorflow", inspected.Format)
140140
assert.Equal(t, "Qwen2.5-0.5B", inspected.Name)
141-
assert.Equal(t, "50000000000", inspected.ParamSize)
141+
assert.Equal(t, "0.5b", inspected.ParamSize)
142142
assert.Equal(t, "int8", inspected.Precision)
143143
assert.Equal(t, "gptq", inspected.Quantization)
144144
assert.Len(t, inspected.Layers, 8)

0 commit comments

Comments
 (0)