Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/cli/search/backend_resolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func backendFromFormat(format disttypes.Format) string {
return backendLlamaCpp
case disttypes.FormatSafetensors:
return backendVLLM
case disttypes.FormatDiffusers:
case disttypes.FormatDDUF, disttypes.FormatDiffusers: //nolint:staticcheck // FormatDiffusers kept for backward compatibility
return backendDiffusers
default:
return backendUnknown
Expand Down
3 changes: 2 additions & 1 deletion cmd/cli/search/backend_resolution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func TestBackendFromFormat(t *testing.T) {
}{
{name: "gguf", format: disttypes.FormatGGUF, want: backendLlamaCpp},
{name: "safetensors", format: disttypes.FormatSafetensors, want: backendVLLM},
{name: "diffusers", format: disttypes.FormatDiffusers, want: backendDiffusers},
{name: "dduf", format: disttypes.FormatDDUF, want: backendDiffusers},
{name: "diffusers (deprecated)", format: disttypes.FormatDiffusers, want: backendDiffusers}, //nolint:staticcheck // FormatDiffusers kept for backward compatibility
{name: "unknown", format: "", want: backendUnknown},
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/distribution/builder/from_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func FromDirectory(dirPath string, opts ...DirectoryOption) (*Builder, error) {
weightFiles = append(weightFiles, path)
case files.FileTypeDDUF:
if detectedFormat == "" {
detectedFormat = types.FormatDiffusers
detectedFormat = types.FormatDDUF
}
weightFiles = append(weightFiles, path)
case files.FileTypeUnknown, files.FileTypeConfig, files.FileTypeLicense, files.FileTypeChatTemplate:
Expand Down
6 changes: 3 additions & 3 deletions pkg/distribution/format/dduf.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func init() {

// Name returns the format identifier for DDUF.
func (d *DDUFFormat) Name() types.Format {
return types.FormatDiffusers
return types.FormatDDUF
}

// MediaType returns the OCI media type for DDUF layers.
Expand All @@ -39,7 +39,7 @@ func (d *DDUFFormat) DiscoverShards(path string) ([]string, error) {
// DDUF files are zip archives containing model config, so we extract what we can.
func (d *DDUFFormat) ExtractConfig(paths []string) (types.Config, error) {
if len(paths) == 0 {
return types.Config{Format: types.FormatDiffusers}, nil
return types.Config{Format: types.FormatDDUF}, nil
}

// Calculate total size across all files
Expand All @@ -59,7 +59,7 @@ func (d *DDUFFormat) ExtractConfig(paths []string) (types.Config, error) {
// In the future, we could extract model_index.json from the DDUF archive
// to get architecture details, etc.
return types.Config{
Format: types.FormatDiffusers,
Format: types.FormatDDUF,
Architecture: "diffusers",
Size: formatSize(totalSize),
Diffusers: map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion pkg/distribution/format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func DetectFromPath(path string) (Format, error) {
case files.FileTypeSafetensors:
return Get(types.FormatSafetensors)
case files.FileTypeDDUF:
return Get(types.FormatDiffusers)
return Get(types.FormatDDUF)
case files.FileTypeUnknown, files.FileTypeConfig, files.FileTypeLicense, files.FileTypeChatTemplate:
return nil, fmt.Errorf("unable to detect format from path: %s (file type: %s)", utils.SanitizeForLog(path), ft)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/distribution/internal/bundle/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func unpackLegacy(dir string, model types.Model) (*Bundle, error) {
if err := unpackSafetensors(bundle, model); err != nil {
return nil, fmt.Errorf("unpack safetensors files: %w", err)
}
case types.FormatDiffusers:
case types.FormatDiffusers, types.FormatDDUF: //nolint:staticcheck // FormatDiffusers kept for backward compatibility
if err := unpackDDUF(bundle, model); err != nil {
return nil, fmt.Errorf("unpack DDUF file: %w", err)
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func detectModelFormat(model types.Model) types.Format {
// Check for DDUF files
ddufPaths, err := model.DDUFPaths()
if err == nil && len(ddufPaths) > 0 {
return types.FormatDiffusers
return types.FormatDDUF
}

return ""
Expand Down
4 changes: 3 additions & 1 deletion pkg/distribution/modelpack/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,10 @@ func (m *Model) GetFormat() types.Format {
return types.FormatGGUF
case "safetensors":
return types.FormatSafetensors
case "dduf":
return types.FormatDDUF
case "diffusers":
return types.FormatDiffusers
return types.FormatDiffusers //nolint:staticcheck // FormatDiffusers kept for backward compatibility
default:
return types.Format(f)
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/distribution/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ const (

FormatGGUF = Format("gguf")
FormatSafetensors = Format("safetensors")
FormatDiffusers = Format("diffusers")
FormatDDUF = Format("dduf")
// Deprecated: FormatDiffusers is kept for backward compatibility with models
// that have "format": "diffusers" in their config. Use FormatDDUF instead.
FormatDiffusers = Format("diffusers")

// OCI Annotation keys for model layers
// See https://github.com/opencontainers/image-spec/blob/main/annotations.md
Expand Down
Loading