Skip to content

Commit 68abdd9

Browse files
committed
feat: prevent duplicate config archive layers during model creation
1 parent af3e40e commit 68abdd9

File tree

1 file changed

+8
-0
lines changed
  • pkg/distribution/internal/safetensors

1 file changed

+8
-0
lines changed

pkg/distribution/internal/safetensors/create.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ func NewModelWithConfigArchive(safetensorsPaths []string, configArchivePath stri
7979

8080
// Add config archive layer
8181
if configArchivePath != "" {
82+
// Check if a config archive layer already exists
83+
for _, layer := range model.layers {
84+
mediaType, err := layer.MediaType()
85+
if err == nil && mediaType == types.MediaTypeVLLMConfigArchive {
86+
return nil, fmt.Errorf("model already has a config archive layer")
87+
}
88+
}
89+
8290
configLayer, err := partial.NewLayer(configArchivePath, types.MediaTypeVLLMConfigArchive)
8391
if err != nil {
8492
return nil, fmt.Errorf("create config archive layer from %q: %w", configArchivePath, err)

0 commit comments

Comments
 (0)