mrcmilo commited on
Commit
c82b290
·
verified ·
1 Parent(s): 7b0adef

Update README: correct Modelfile template and add ollama example

Browse files
Files changed (1) hide show
  1. README.md +14 -15
README.md CHANGED
@@ -21,46 +21,45 @@ This is a specialized **Text-to-SQL** model fine-tuned from the **Microsoft Phi-
21
  - **Training Technique:** Fine-tuned using Lora with [Unsloth](https://github.com/unslothai/unsloth).
22
  - **Format:** GGUF (Ready for Ollama, LM Studio, and llama.cpp)
23
  - **phi-3-mini-4k-instruct.Q4_K_M.gguf**
24
- - **phi-3-mini-4k-instruct.Q5_K_M.gguf**
25
 
26
  ## Usage Instructions
27
 
28
  ### Ollama (Recommended)
29
  To deploy locally:
30
 
31
- 1. Download the `.gguf` file.
32
 
33
  2. Create the Modelfile with the following instructions
34
 
35
  ```Dockerfile
36
  FROM ./phi-3-mini-4k-instruct.Q4_K_M.gguf
37
 
38
- SYSTEM """You are a specialized SQL assistant. Your goal is to produce valid SQL queries based on the provided schema and question. Output only the SQL code and nothing else."""
39
-
40
- TEMPLATE """<|system|>
41
- {{ .System }}<|end|>
42
- <|user|>
43
- {{ .Prompt }}<|end|>
44
  <|assistant|>
45
  """
46
 
 
47
  PARAMETER stop "<|end|>"
48
- PARAMETER temperature 0.1
49
- PARAMETER num_ctx 2048
50
- PARAMETER repeat_penalty 1.2
51
  ```
52
 
53
  3. Run ```ollama create phi3-sql-expert -f Modelfile```
54
 
55
- 5. Run ```ollama run phi3-sql-expert```
56
 
 
57
 
58
  ## Evaluation Data
59
- The model was fine-tuned on the sql-create-context dataset, focusing on:
60
 
61
- - Mapping natural language to complex SELECT, WHERE, and JOIN statements.
62
  - Understanding table schemas provided in the prompt.
63
- - Maintaining strict SQL syntax.
64
 
65
  ## Recommended Settings
66
  Temperature: 0.0 or 0.1 (SQL requires deterministic output).
 
21
  - **Training Technique:** Fine-tuned using Lora with [Unsloth](https://github.com/unslothai/unsloth).
22
  - **Format:** GGUF (Ready for Ollama, LM Studio, and llama.cpp)
23
  - **phi-3-mini-4k-instruct.Q4_K_M.gguf**
24
+ - **phi-3-mini-4k-instruct.Q5_K.gguf**
25
 
26
  ## Usage Instructions
27
 
28
  ### Ollama (Recommended)
29
  To deploy locally:
30
 
31
+ 1. Download the `.gguf` file (Q4 or Q5).
32
 
33
  2. Create the Modelfile with the following instructions
34
 
35
  ```Dockerfile
36
  FROM ./phi-3-mini-4k-instruct.Q4_K_M.gguf
37
 
38
+ TEMPLATE """<s><|user|>
39
+ Schema: {{ .System }}
40
+ Question: {{ .Prompt }}<|end|>
 
 
 
41
  <|assistant|>
42
  """
43
 
44
+ # Parameters for SQL stability
45
  PARAMETER stop "<|end|>"
46
+ PARAMETER stop "<s>"
47
+ PARAMETER stop "</s>"
48
+ PARAMETER temperature 0.0
49
  ```
50
 
51
  3. Run ```ollama create phi3-sql-expert -f Modelfile```
52
 
53
+ 5. Run ```ollama run phi3-sql-expert "schema: CREATE TABLE table_name_7 (nba_draft VARCHAR, school VARCHAR) question: What was the NBA draft status for Northeast High School?"```
54
 
55
+ 6. The answer should be ```SELECT nba_draft FROM table_name_7 WHERE school = "Northeast"```
56
 
57
  ## Evaluation Data
58
+ The model was fine-tuned on the [sql-create-context dataset](https://huggingface.co/datasets/b-mc2/sql-create-context), focusing on:
59
 
60
+ - Mapping natural language to SQL queries with SELECT, WHERE, and JOIN statements.
61
  - Understanding table schemas provided in the prompt.
62
+ - Maintaining strict SQL syntax in the response.
63
 
64
  ## Recommended Settings
65
  Temperature: 0.0 or 0.1 (SQL requires deterministic output).