View Issue Details

IDProjectCategoryView StatusLast Update
0000623fileGeneralpublic2025-02-08 23:03
Reporternoahbpeterson Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
PlatformDarwin arm64OSmacOSOS VersionSequoia 15.3
Product Version5.46 
Summary0000623: Add support for gguf files
DescriptionCurrent, the file command does not recognize gguf files created by the llama.cpp project.

The attached patch adds support for gguf files of this type.
Steps To ReproduceModel example download link: https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1/resolve/main/model.safetensors?download=true

```bash
$ file ~/Downloads/mxbai-embed-large-v1
/Users/noahpeterson/Downloads/mxbai-embed-large-v1.gguf: data
```

With the patch applied:

```bash
$ file ~/Downloads/mxbai-embed-large-v1
/Users/noahpeterson/Downloads/mxbai-embed-large-v1.gguf: GGUF file format version 3, 389 tensors, 23 metadata entries, Architecture: bert, Name: mxbai-embed-large-v1, Block Count: 24, Context Length: 512, Embedding Length: 1024
```
TagsNo tags attached.

Activities

noahbpeterson

2025-02-08 23:03

reporter  

0001-Add-support-for-GGUF.patch (2,088 bytes)   
From 3ccd492477811daadef18be55f0a0dd9e864190c Mon Sep 17 00:00:00 2001
From: Noah Peterson <NoahBPeterson1997@gmail.com>
Date: Sat, 8 Feb 2025 16:58:34 -0600
Subject: [PATCH] Add support for GGUF

This adds support for the llama.cpp project's GGUF format

Signed-off-by: Noah Peterson <noahbpeterson1997@gmail.com>
---
 magic/Magdir/gguf | 23 +++++++++++++++++++++++
 magic/Makefile.am |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 magic/Magdir/gguf

diff --git a/magic/Magdir/gguf b/magic/Magdir/gguf
new file mode 100644
index 00000000..37862e51
--- /dev/null
+++ b/magic/Magdir/gguf
@@ -0,0 +1,23 @@
+
+#------------------------------------------------------------------------------
+# $File: gguf.magic,v 1.1 2025/02/08 16:16:52 noah Exp $
+# 
+#
+# GGUF: magic file for GGUF-models
+# URL:  https://github.com/ggml-org/ggml/
+# From: Noah Peterson <noahbpeterson1997@gmail.com>
+
+0          string      GGUF               GGUF file format
+>4         byte        x                  version %d
+>8         quad        x                  \b, %llu tensors
+>16        quad        >0                 \b, %llu metadata entries
+>&8        search/256  general.architecture    
+>>&12      regex       ([A-Za-z0-9\-]+)   \b, Architecture: %s
+>&8        search/256  general.name    
+>>&12      regex       ([A-Za-z0-9\ \-]+) \b, Name: %s
+>&0        search/512  .block_count
+>>&4       long        x                  \b, Block Count: %u
+>&0        search/512  context_length
+>>&4       long        x                  \b, Context Length: %u
+>&0        search/512  embedding_length
+>>&4       long        x                  \b, Embedding Length: %u
diff --git a/magic/Makefile.am b/magic/Makefile.am
index c28b730c..6758e43c 100644
--- a/magic/Makefile.am
+++ b/magic/Makefile.am
@@ -124,6 +124,7 @@ $(MAGIC_FRAGMENT_DIR)/gconv \
 $(MAGIC_FRAGMENT_DIR)/gentoo \
 $(MAGIC_FRAGMENT_DIR)/geo \
 $(MAGIC_FRAGMENT_DIR)/geos \
+$(MAGIC_FRAGMENT_DIR)/gguf \
 $(MAGIC_FRAGMENT_DIR)/gimp \
 $(MAGIC_FRAGMENT_DIR)/git \
 $(MAGIC_FRAGMENT_DIR)/glibc \
-- 
2.39.5 (Apple Git-154)

Issue History

Date Modified Username Field Change
2025-02-08 23:03 noahbpeterson New Issue
2025-02-08 23:03 noahbpeterson File Added: 0001-Add-support-for-GGUF.patch