github.com/anchore/syft@v1.38.2/syft/pkg/gguf.go (about) 1 package pkg 2 3 // GGUFFileHeader represents metadata extracted from a GGUF (GPT-Generated Unified Format) model file. 4 // GGUF is a binary file format used for storing model weights for the GGML library, designed for fast 5 // loading and saving of models, particularly quantized large language models. 6 // The Model Name, License, and Version fields have all been lifted up to be on the syft Package. 7 type GGUFFileHeader struct { 8 // GGUFVersion is the GGUF format version (e.g., 3) 9 GGUFVersion uint32 `json:"ggufVersion" cyclonedx:"ggufVersion"` 10 11 // FileSize is the size of the GGUF file in bytes (best-effort if available from resolver) 12 FileSize int64 `json:"fileSize,omitempty" cyclonedx:"fileSize"` 13 14 // Architecture is the model architecture (from general.architecture, e.g., "qwen3moe", "llama") 15 Architecture string `json:"architecture,omitempty" cyclonedx:"architecture"` 16 17 // Quantization is the quantization type (e.g., "IQ4_NL", "Q4_K_M") 18 Quantization string `json:"quantization,omitempty" cyclonedx:"quantization"` 19 20 // Parameters is the number of model parameters (if present in header) 21 Parameters uint64 `json:"parameters,omitempty" cyclonedx:"parameters"` 22 23 // TensorCount is the number of tensors in the model 24 TensorCount uint64 `json:"tensorCount" cyclonedx:"tensorCount"` 25 26 // RemainingKeyValues contains the remaining key-value pairs from the GGUF header that are not already 27 // represented as typed fields above. This preserves additional metadata fields for reference 28 // (namespaced with general.*, llama.*, etc.) while avoiding duplication. 29 RemainingKeyValues map[string]interface{} `json:"header,omitempty" cyclonedx:"header"` 30 31 // MetadataKeyValuesHash is a xx64 hash of all key-value pairs from the GGUF header metadata. 32 // This hash is computed over the complete header metadata (including the fields extracted 33 // into typed fields above) and provides a stable identifier for the model configuration 34 // across different file locations or remotes. It allows matching identical models even 35 // when stored in different repositories or with different filenames. 36 MetadataKeyValuesHash string `json:"metadataHash,omitempty" cyclonedx:"metadataHash"` 37 }