prabhugururaj88 commited on
Commit
69fc2cb
·
verified ·
1 Parent(s): 28a1e7c

Upload gemma2-mql-v2 Q4_K_M GGUF + training data

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ gemma2-mql-v2-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
Modelfile ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM /Users/pg47711/Downloads/content/gemma2-mql-v2-Q4_K_M.gguf
2
+
3
+ TEMPLATE """{{ if .System }}<start_of_turn>system
4
+ {{ .System }}<end_of_turn>
5
+ {{ end }}{{ if .Prompt }}<start_of_turn>user
6
+ {{ .Prompt }}<end_of_turn>
7
+ {{ end }}<start_of_turn>model
8
+ {{ .Response }}<end_of_turn>
9
+ """
10
+
11
+ SYSTEM """You are a MongoDB query generator. Given a natural language question about files in the EntityViews collection, generate the correct MongoDB query (MQL) as JSON. Always use $regex with case-insensitive matching for name searches unless an exact path is provided. The collection has fields: name, extension, format, size, type, entity_type, has_pii, processed, create_time, modified_time, access_time, permissions, content_attributes, change_type, errors, custom_attributes."""
12
+
13
+ PARAMETER temperature 0.1
14
+ PARAMETER top_p 0.9
15
+ PARAMETER stop "<end_of_turn>"
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: google/gemma-2-2b-it
4
+ tags:
5
+ - text-to-mql
6
+ - mongodb
7
+ - netapp
8
+ - aidp
9
+ - gemma2
10
+ - gguf
11
+ - fine-tuned
12
+ language:
13
+ - en
14
+ pipeline_tag: text-generation
15
+ ---
16
+
17
+ # Gemma 2 2B - Text to MQL (MongoDB Query Language)
18
+
19
+ A fine-tuned Gemma 2 2B-IT model that converts natural language questions into MongoDB queries (MQL) for the AIDP EntityViews collection.
20
+
21
+ ## Model Details
22
+
23
+ - **Base model**: google/gemma-2-2b-it
24
+ - **Fine-tuned on**: 1,164 text-to-MQL training samples
25
+ - **Task**: Natural language to MongoDB query generation
26
+ - **Format**: GGUF (Q4_K_M quantized)
27
+ - **Size**: 1.6 GB
28
+
29
+ ## Available Files
30
+
31
+ | File | Format | Size | Description |
32
+ |---|---|---|---|
33
+ | `gemma2-mql-v2-Q4_K_M.gguf` | GGUF Q4_K_M | 1.6 GB | Recommended - best size/quality balance |
34
+ | `gemma2-mql-v2-f16.gguf` | GGUF F16 | 4.9 GB | Full precision |
35
+
36
+ ## Supported Fields
37
+
38
+ The model generates MQL queries for the EntityViews collection with these fields:
39
+ - `name` - file path/name
40
+ - `extension` - file extension (txt, tiff, exr, usd, jpg, png)
41
+ - `format` - file format
42
+ - `size` - file size in bytes
43
+ - `type` / `entity_type` - entity type
44
+ - `has_pii` - whether file contains PII
45
+ - `processed` - processing status
46
+ - `create_time` / `modified_time` / `access_time` - timestamps
47
+ - `permissions` - Unix permissions (e.g., rw-r--r--)
48
+ - `content_attributes` - extracted content metadata including image descriptions
49
+ - `change_type` - ADDED, MODIFIED, etc.
50
+ - `errors` - processing errors
51
+ - `custom_attributes` - custom metadata
52
+
53
+ ## Usage with Ollama
54
+
55
+ ```bash
56
+ # Download the GGUF file, then create a Modelfile:
57
+ cat > Modelfile << 'EOF'
58
+ FROM ./gemma2-mql-v2-Q4_K_M.gguf
59
+
60
+ TEMPLATE """{{ if .System }}<start_of_turn>system
61
+ {{ .System }}<end_of_turn>
62
+ {{ end }}{{ if .Prompt }}<start_of_turn>user
63
+ {{ .Prompt }}<end_of_turn>
64
+ {{ end }}<start_of_turn>model
65
+ {{ .Response }}<end_of_turn>
66
+ """
67
+
68
+ SYSTEM """You are a MongoDB query generator. Given a natural language question about files in the EntityViews collection, generate the correct MongoDB query (MQL) as JSON. Always use $regex with case-insensitive matching for name searches unless an exact path is provided."""
69
+
70
+ PARAMETER temperature 0.1
71
+ PARAMETER top_p 0.9
72
+ PARAMETER stop "<end_of_turn>"
73
+ EOF
74
+
75
+ ollama create gemma2-mql -f Modelfile
76
+ ollama run gemma2-mql "Find all tiff files larger than 10MB"
77
+ ```
78
+
79
+ ## Usage with vLLM (NVIDIA L4 GPU)
80
+
81
+ ```bash
82
+ # For the F16 safetensors version, use the base fine-tuned model directly:
83
+ pip install vllm
84
+
85
+ python -m vllm.entrypoints.openai.api_server \
86
+ --model <your-hf-username>/gemma2-mql-v2 \
87
+ --dtype bfloat16 \
88
+ --max-model-len 4096 \
89
+ --gpu-memory-utilization 0.9
90
+ ```
91
+
92
+ ## Example Queries
93
+
94
+ | Input | Generated MQL |
95
+ |---|---|
96
+ | "Find all tiff files larger than 10MB" | `{"$and": [{"extension": "tiff"}, {"size": {"$gt": 10485760}}]}` |
97
+ | "Show files with PII" | `{"has_pii": true}` |
98
+ | "Find the file water-droplet" | `{"name": {"$regex": ".*water-droplet.*", "$options": "i"}}` |
99
+ | "How many exr files are there" | `{"collection": "EntityViews", "method": "count", "filter": {"extension": "exr"}}` |
100
+ | "Show me top 5 files by sizes" | `{"collection": "EntityViews", "method": "find", "filter": {}, "sort": {"size": -1}, "limit": 5}` |
101
+ | "What images show the Golden Gate Bridge" | `{"content_attributes": {"$elemMatch": {"key": "Image Description", "value": {"$regex": ".*Golden Gate Bridge.*", "$options": "i"}}}}` |
102
+
103
+ ## Training Data
104
+
105
+ Fine-tuned on 1,164 samples covering:
106
+ - Name search (exact, regex, path-based): 437 samples
107
+ - Extension filters: 267 samples
108
+ - Size comparisons: 177 samples
109
+ - Content attribute search: 176 samples
110
+ - Compound queries: 112 samples
111
+ - PII/processed flags: 116 samples
112
+ - Permissions (Unix notation): 59 samples
113
+ - Count/distinct/sort operations: 116 samples
114
+ - Error detection: 26 samples
gemma2-mql-v2-Q4_K_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7289048aa1520675e4202a54f04c167108be8a7dee43f120f300d4a4bacf073
3
+ size 1708583328
text_to_mql_training_data.json ADDED
The diff for this file is too large to render. See raw diff