TroyDoesAI commited on
Commit
ae2432f
·
verified ·
1 Parent(s): 8c901d4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +214 -3
README.md CHANGED
@@ -1,3 +1,214 @@
1
- ---
2
- license: cc-by-nd-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ ---
4
+
5
+ # Introducing Mermaid-Llama-6.7B-RAG
6
+
7
+ Powered by 6.7 billion parameters, this model sets the bar for excellence in
8
+ AI-driven code comprehension and narrative visualization now with further reduction of hallucinations inspired by https://huggingface.co/jondurbin
9
+ who created the "Context-Obedient" chat template. We stand on the shoulders of Giants, so we thank you Jon Durbin the original RAG pioneer for LLM's.
10
+ Special Thanks to Eric Hartford for sharing his intuition with me personally on prompt templates, your shared wisdom has helped me innovate my own style that works for my own specialized Mermaid Models.
11
+
12
+ Beyond turning input into Flow Diagrams this RAG Model excels in Formatted Knowledge Graph utilization in the Mermaid JS Syntax.
13
+ Now includes an enhanced capability called "Code Instruct," which allows the model to generate executable code snippets directly from user instructions.
14
+
15
+ See more Mermaid Here : https://www.mermaidchart.com
16
+
17
+ ![MermaidLlama GIF](Mermaid_ShowCase/MermaidLlama.webp)
18
+
19
+ ---
20
+ ```
21
+ Note: I have been informed over this past 2 months that my models are being used in production.
22
+ Through insights gathered on how my models are being used effectively in business environments
23
+ I have tailored this model to the needs of those that have reached out to me.
24
+
25
+ So please enjoy, and feedback is always welcome, good or bad. I prefer bad actually.
26
+ - Current Issue is lack of compute - I will solve once I get a job / money to train : Context length of 4096 is very limiting for those that want full system diagrams without using aggregation strategies.
27
+ ```
28
+
29
+ ### Key Features
30
+
31
+ 1. **Code Understanding:**
32
+ - Masters Python's intricacies.
33
+ - Generates accurate Mermaid Diagram Flow Charts.
34
+ - Ideal for developers visualizing code logic.
35
+
36
+ 2. **Storytelling Capabilities:**
37
+ - Converts narratives into captivating Mermaid Diagrams.
38
+ - Maps character interactions, plot developments, and narrative arcs.
39
+
40
+ 3. **Unmatched Performance:**
41
+ - Surpasses GPT-4 in generating well-organized Mermaid Diagrams.
42
+
43
+ 4. **Enhanced Adherence to Context (New):**
44
+ - Incorporates contextual prompts to improve adherence and reduce hallucinations.
45
+ - Supports the airoboros context-obedient format.
46
+
47
+ ### Collaboration
48
+
49
+ For collaboration opportunities to enhance Mermaid's capabilities, contact troydoesai@gmail.com.
50
+
51
+ ### Use Cases
52
+
53
+ - **Retrieval-Augmented Generation (RAG):** Creates condensed knowledge graphs to enhance retrieval using vector databases for efficient information retrieval. Combines knowledge graphs and context-aware RAG capabilities for better knowledge condensation.
54
+ - **Code Documentation:** Generates automatic visual flow charts from Python code.
55
+ - **Storyboarding:** Creates visually appealing diagrams for storytelling.
56
+ - **Project Planning:** Generates visual project flow maps for effective team communication.
57
+ - **Learning Python:** Assists students in visualizing Python code structures.
58
+ - **Game Design:** Visualizes game storylines for coherent narrative structure.
59
+
60
+ ### Dataset Format (New)
61
+ To enhance contextual adherence and reduce hallucinations, the dataset follows the format below:
62
+
63
+ ```
64
+ BEGININPUT
65
+ BEGINCONTEXT
66
+ [key0: value0]
67
+ [key1: value1]
68
+ ENDCONTEXT
69
+ [insert your text blocks here]
70
+ ENDINPUT
71
+ BEGININSTRUCTION
72
+ [insert your instruction(s)]
73
+ ENDINSTRUCTION
74
+ ```
75
+
76
+ This structure, while verbose, helps models understand specific responses and sources.
77
+
78
+ ### Example
79
+
80
+ **Prompt:**
81
+ ```
82
+ BEGININPUT
83
+ BEGINCONTEXT
84
+ date: 2021-01-01
85
+ url: https://web.site/123
86
+ ENDCONTEXT
87
+ Blueberries are now green.
88
+ ENDINPUT
89
+ BEGININSTRUCTION
90
+ What color are blueberries? Source?
91
+ ENDINSTRUCTION
92
+ ```
93
+
94
+ **Expected Response:**
95
+ ```
96
+ Blueberries are now green.
97
+ Source:
98
+ date: 2021-01-01
99
+ url: https://web.site/123
100
+ ```
101
+
102
+ ---
103
+
104
+ ## New Feature: Code Instruct
105
+
106
+ The Mermaid-Llama-6.7B-RAG model now includes an enhanced capability called "Code Instruct," which allows the model to generate executable code snippets directly from user instructions. This feature is particularly useful for developers and educators who need to quickly generate code examples or want to automate coding tasks.
107
+
108
+ ### How It Works
109
+
110
+ To use the Code Instruct feature, provide a clear and concise instruction in the following template:
111
+
112
+ ```markdown
113
+ Code-Assistant-Request:
114
+ {instruction}
115
+
116
+ ### Code:
117
+ ```
118
+
119
+ The model interprets the instruction and generates a corresponding code block that attempts to fulfill the specified task. This feature leverages the model's deep understanding of code syntax and semantics, enhanced by training on a diverse range of programming tasks.
120
+
121
+ ### Example Usage
122
+
123
+ **Instruction:**
124
+ ```
125
+ Code-Assistant-Request:
126
+ Create a Python function to calculate the factorial of a number
127
+
128
+ ### Code:
129
+ ```
130
+
131
+ **Generated Code:**
132
+ ```python
133
+ def factorial(n):
134
+ if n == 0:
135
+ return 1
136
+ else:
137
+ return n * factorial(n-1)
138
+
139
+ print(factorial(5)) # Output: 120
140
+ ```
141
+
142
+ ![5 CODE_INSTRUCT GIF](Mermaid_ShowCase/5_Code_Instruct.gif)
143
+
144
+ ---
145
+
146
+ ### Proof of Concept
147
+
148
+ A VSCode Extension is forthcoming, providing a live flow map upon pausing for more than 10 seconds.
149
+
150
+ ### Training Specifications
151
+
152
+ - **LoRA Rank:** 2048
153
+ - **LoRA Alpha:** 4096
154
+ - **Batch Size:** 1
155
+ - **Micro Batch Size:** 1
156
+ - **Cutoff Length:** 4096
157
+ - **Save every n steps:** 1000
158
+ - **Epochs:** 3
159
+ - **Learning Rate:** 1e-6
160
+ - **LR Scheduler:** Cosine
161
+
162
+ **Target Modules:**
163
+ - Enable q_proj
164
+ - Enable v_proj
165
+ - Enable k_proj
166
+ - Enable o_proj
167
+ - Enable gate_proj
168
+ - Enable down_proj
169
+ - Enable up_proj
170
+
171
+ ---
172
+
173
+ ## Getting Started
174
+
175
+ Start by downloading one of my models.
176
+
177
+ ![0 TroyDoesAI GIF](Mermaid_ShowCase/0_TroyDoesAI.gif)
178
+
179
+ Load the model.
180
+
181
+ ![1 Load Model in 4-bit Show Example Use GIF](Mermaid_ShowCase/1_LoadModel_in_4bit_Show_Example_Use.gif)
182
+
183
+ Use my prompt template to generate a Mermaid code block, which can be viewed in the Mermaid Live Editor or using the Mermaid CLI tool.
184
+
185
+ ![2 Loaded Model in Full Precision 16-bit Show Inference and Mermaid Live Editor GIF](Mermaid_ShowCase/2_Loaded_Model_in_Full_Precision_16bit_Show_Inference_and_Mermaid_Live_editor.gif)
186
+
187
+ Here we open the VLLM GUI Program while still running in Vram the Mermaid-Llama-8B to compare the flow diagram to the actual program and show the lightweight capabilites of small models on consumer hardware.
188
+
189
+ ![3 Open The Program VLLM Program With Full Precision Mermaid-Llama-8B Running to Evaluate Flow Map GIF](Mermaid_ShowCase/3_Open_The_Program_VLLM_Program_With_Full_Precision_Mermaid-Llama-8B-Running_to_evaluate_flow_map.gif)
190
+
191
+ ## More on my VLLM Class and inference GUI : https://github.com/Troys-Code/VLLM
192
+
193
+ ![Python RtdBsaz8gy GIF](Mermaid_ShowCase/python_RtdBsaz8gy.gif)
194
+ ---
195
+
196
+ Note: This model should be treated as an Auto-Complete Model, Do not try talking to it in chat you are gonna get garbage, those layers have been pruned and replaced, that is all you will hear of my secret sauce on training on small < 1000 entry datasets.
197
+
198
+ ```
199
+ ԅ(≖‿≖ԅ)
200
+ STAY TUNED: THERES MORE TO COME, SOON MERMAID MODELS WILL BE ABLE TO TURN "MERMAID" --> "CODE"
201
+
202
+ This new dataset is gonna be a game changer for refactoring code blocks if it works.
203
+ I am interviewing like crazy so this may take some time as my days have been hectic, imaging studying for finals week every week.
204
+ ```
205
+
206
+ video on how to use colab notebook and inference the model in the simplest example:
207
+ '''
208
+ https://m.youtube.com/watch?v=fdwoOmiA2d0
209
+ '''
210
+
211
+ colab notebook:
212
+ '''
213
+ https://colab.research.google.com/github/Troys-Code/MermaidEngine/blob/main/Mermaid_Llama_RAG_Colab_TextGen_GPU.ipynb
214
+ '''