Skip to content

Commit b21be44

Browse files
authored
feat: switch to the modelpack model-spec (#415)
Signed-off-by: chlins <chlins.zhang@gmail.com>
1 parent 06ac8b1 commit b21be44

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

pkg/backend/attach.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ const (
5353
var (
5454
// mediaTypePriorityMap defines the priority for layer sorting by group.
5555
mediaTypePriorityMap = map[string]int{
56-
legacymodelspec.MediaTypeModelWeightConfig: modelWeightConfigPriority,
57-
legacymodelspec.MediaTypeModelWeight: modelWeightPriority,
58-
legacymodelspec.MediaTypeModelCode: modelCodePriority,
59-
legacymodelspec.MediaTypeModelDoc: modelDocPriority,
56+
modelspec.MediaTypeModelWeightConfig: modelWeightConfigPriority,
57+
modelspec.MediaTypeModelWeight: modelWeightPriority,
58+
modelspec.MediaTypeModelCode: modelCodePriority,
59+
modelspec.MediaTypeModelDoc: modelDocPriority,
6060
}
6161
)
6262

@@ -143,7 +143,7 @@ func (b *backend) Attach(ctx context.Context, filepath string, cfg *config.Attac
143143
}
144144
}
145145

146-
var config legacymodelspec.Model
146+
var config modelspec.Model
147147
if !cfg.Config {
148148
var reasoning bool
149149
if srcModelConfig.Config.Capabilities != nil && srcModelConfig.Config.Capabilities.Reasoning != nil {
@@ -307,33 +307,33 @@ func (b *backend) getModelConfig(ctx context.Context, reference string, desc oci
307307

308308
func (b *backend) getProcessor(destDir, filepath string, rawMediaType bool) processor.Processor {
309309
if modelfile.IsFileType(filepath, modelfile.ConfigFilePatterns) {
310-
mediaType := legacymodelspec.MediaTypeModelWeightConfig
310+
mediaType := modelspec.MediaTypeModelWeightConfig
311311
if rawMediaType {
312-
mediaType = legacymodelspec.MediaTypeModelWeightConfigRaw
312+
mediaType = modelspec.MediaTypeModelWeightConfigRaw
313313
}
314314
return processor.NewModelConfigProcessor(b.store, mediaType, []string{filepath}, destDir)
315315
}
316316

317317
if modelfile.IsFileType(filepath, modelfile.ModelFilePatterns) {
318-
mediaType := legacymodelspec.MediaTypeModelWeight
318+
mediaType := modelspec.MediaTypeModelWeight
319319
if rawMediaType {
320-
mediaType = legacymodelspec.MediaTypeModelWeightRaw
320+
mediaType = modelspec.MediaTypeModelWeightRaw
321321
}
322322
return processor.NewModelProcessor(b.store, mediaType, []string{filepath}, destDir)
323323
}
324324

325325
if modelfile.IsFileType(filepath, modelfile.CodeFilePatterns) {
326-
mediaType := legacymodelspec.MediaTypeModelCode
326+
mediaType := modelspec.MediaTypeModelCode
327327
if rawMediaType {
328-
mediaType = legacymodelspec.MediaTypeModelCodeRaw
328+
mediaType = modelspec.MediaTypeModelCodeRaw
329329
}
330330
return processor.NewCodeProcessor(b.store, mediaType, []string{filepath}, destDir)
331331
}
332332

333333
if modelfile.IsFileType(filepath, modelfile.DocFilePatterns) {
334-
mediaType := legacymodelspec.MediaTypeModelDoc
334+
mediaType := modelspec.MediaTypeModelDoc
335335
if rawMediaType {
336-
mediaType = legacymodelspec.MediaTypeModelDocRaw
336+
mediaType = modelspec.MediaTypeModelDocRaw
337337
}
338338
return processor.NewDocProcessor(b.store, mediaType, []string{filepath}, destDir)
339339
}

pkg/backend/attach_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"reflect"
2424
"testing"
2525

26-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
26+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2727
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2828
"github.com/stretchr/testify/assert"
2929

pkg/backend/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"path/filepath"
2525

2626
retry "github.com/avast/retry-go/v4"
27-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
27+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2828
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2929
"github.com/sirupsen/logrus"
3030

@@ -40,7 +40,7 @@ import (
4040

4141
const (
4242
// annotationModelfile is the annotation key for the Modelfile.
43-
annotationModelfile = "org.cnai.modctl.modelfile"
43+
annotationModelfile = "org.cncf.modctl.modelfile"
4444
)
4545

4646
// Build builds the user materials into the model artifact which follows the Model Spec.

pkg/backend/build/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
"syscall"
3030
"time"
3131

32-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
3332
sha256 "github.com/minio/sha256-simd"
33+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
3434
godigest "github.com/opencontainers/go-digest"
3535
spec "github.com/opencontainers/image-spec/specs-go"
3636
ocispec "github.com/opencontainers/image-spec/specs-go/v1"

pkg/backend/build/builder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"testing"
3030
"time"
3131

32-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
32+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
3333
godigest "github.com/opencontainers/go-digest"
3434
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
3535
"github.com/stretchr/testify/assert"

pkg/backend/build/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222
"io"
2323

24-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
24+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2525
godigest "github.com/opencontainers/go-digest"
2626
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2727

pkg/backend/build/local_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"strings"
2424
"testing"
2525

26-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
26+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2727
godigest "github.com/opencontainers/go-digest"
2828
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2929
"github.com/stretchr/testify/mock"

pkg/backend/build/remote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222
"io"
2323

24-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
24+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2525
godigest "github.com/opencontainers/go-digest"
2626
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2727

pkg/backend/processor/code_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"path/filepath"
2323
"testing"
2424

25-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
25+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2626
godigest "github.com/opencontainers/go-digest"
2727
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
2828
"github.com/stretchr/testify/assert"

pkg/backend/processor/doc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
buildmock "github.com/modelpack/modctl/test/mocks/backend/build"
2626
"github.com/modelpack/modctl/test/mocks/storage"
2727

28-
modelspec "github.com/dragonflyoss/model-spec/specs-go/v1"
28+
modelspec "github.com/modelpack/model-spec/specs-go/v1"
2929
godigest "github.com/opencontainers/go-digest"
3030
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
3131
"github.com/stretchr/testify/assert"

0 commit comments

Comments
 (0)