TroyDoesAI commited on
Commit
a8f17a2
·
verified ·
1 Parent(s): 829a2a0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -373
README.md CHANGED
@@ -1,379 +1,12 @@
1
  ---
2
  license: cc-by-nc-sa-4.0
3
  ---
 
4
 
5
- Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
 
6
 
7
- ### Instruction:
8
- Create the detailed flow diagram utilizing mermaid js syntax separating functions from main logic:
9
 
10
- ### Input:
11
- #!/bin/bash
12
- #set -x
13
-
14
- log_file="bito_usage_log.txt"
15
- prompt_folder="AI_Prompts"
16
- total_input_token_count=0
17
- total_output_token_count=0
18
- lang_csv="programming_languages.csv"
19
- skip_list_csv="skip_list.csv"
20
-
21
- function bito_response_ok() {
22
- echo "Validating response from Bito command..." >&2
23
- [[ $1 -ne 0 || $2 == Whoops* || -z $2 ]] && return 1 || return 0
24
- }
25
-
26
- function update_token_usage() {
27
- echo "Updating session token counts..." >&2
28
- local tokens=$(echo "$1 $2" | wc -w | awk '{print int($1 * 1.34)}')
29
- total_input_token_count=$((total_input_token_count + tokens))
30
- total_output_token_count=$((total_output_token_count + tokens))
31
- }
32
-
33
- function log_token_usage_and_session_duration() {
34
- echo "Finalizing session log with token usage and duration..." >&2
35
- local duration=$(( $(date +%s) - start_time ))
36
- echo "-----------------------------------------" | tee -a "$log_file"
37
- echo "$(date "+%Y-%m-%d %H:%M:%S") - Total Token Usage for Session" | tee -a "$log_file"
38
- echo "Total Input Tokens = $total_input_token_count" | tee -a "$log_file"
39
- echo "Total Output Tokens = $total_output_token_count" | tee -a "$log_file"
40
- echo "Session Duration: $((duration / 3600))h $(((duration % 3600) / 60))m $((duration % 60))s" | tee -a "$log_file"
41
- echo "-----------------------------------------" | tee -a "$log_file"
42
- }
43
-
44
- function check_tools_and_files() {
45
- echo "Ensuring all necessary tools and files are available..." >&2
46
- local required_tools=("bito" "code2flow" "dot")
47
- local required_files=("high_level_doc_prompt.txt" "system_introduction_prompt.txt")
48
-
49
- for tool in "${required_tools[@]}"; do
50
- if ! command -v "$tool" &> /dev/null; then
51
- echo -e "\nError: Tool $tool is required but not found."
52
- case "$tool" in
53
- "bito")
54
- echo " Install Bito CLI on MAC and Linux with:"
55
- echo " sudo curl https://alpha.bito.ai/downloads/cli/install.sh -fsSL | bash"
56
- echo " On Archlinux, install with yay or paru: yay -S bito-cli or paru -S bito-cli"
57
- echo " For Windows, download and install the MSI from Bito's website."
58
- echo " Follow the instructions provided by the installer."
59
- ;;
60
- "code2flow")
61
- echo " Install Code2Flow from: https://github.com/scottrogowski/code2flow"
62
- echo " Ensure it's accessible in your PATH."
63
- ;;
64
- "dot")
65
- echo " Install Graphviz (dot) from: https://graphviz.org/download/"
66
- echo " Ensure it's accessible in your PATH."
67
- ;;
68
- esac
69
- exit 1
70
- fi
71
- done
72
-
73
- for file in "${required_files[@]}"; do
74
- if [ ! -f "$prompt_folder/$file" ]; then
75
- echo -e "\nError: Missing required file: $prompt_folder/$file"
76
- exit 1
77
- fi
78
- done
79
- echo -e "All required tools and files are present. Proceeding...\n" >&2
80
- }
81
-
82
- function read_skip_list() {
83
- echo "Loading exclusion patterns from skip list..." >&2
84
- if [ -f "$skip_list_csv" ]; then
85
- skip_list=()
86
- while IFS=, read -r skip_item; do
87
- skip_list+=("$skip_item")
88
- done < "$skip_list_csv"
89
- else
90
- echo "Skip list file $skip_list_csv not found."
91
- exit 1
92
- fi
93
- }
94
-
95
- function is_skippable() {
96
- echo "Evaluating if the path $1 should be excluded..." >&2
97
- local path=$1
98
- local skip_dirs_files=("logs" "node_modules" "dist" "target" "bin" "package-lock.json" "data.json" "build" ".gradle" ".idea" "gradle" "extension.js" "vendor.js" "ngsw.json" "polyfills.js" "init" ".gv")
99
-
100
- for skip_item in "${skip_dirs_files[@]}"; do
101
- if [[ "$path" == *"$skip_item"* ]]; then
102
- return 0
103
- fi
104
- done
105
-
106
- if [[ $(basename "$path") == .* ]]; then
107
- return 0
108
- fi
109
-
110
- return 1
111
- }
112
-
113
- function call_bito_with_retry() {
114
- echo "Initiating Bito command with retry for prompt file $2..." >&2
115
- local input_text=$1 prompt_file_path=$2 error_message=$3
116
- local attempt=1 MAX_RETRIES=5 RETRY_DELAY=10 output
117
-
118
- while [ $attempt -le $MAX_RETRIES ]; do
119
- echo "Attempt $attempt: Calling Bito for prompt '$prompt_file_path'..." >&2
120
- output=$(echo -e "$input_text" | bito -p "$prompt_file_path")
121
- local ret_code=$?
122
-
123
- if ! bito_response_ok "$ret_code" "$output"; then
124
- echo "Attempt $attempt: $error_message Retrying in $RETRY_DELAY seconds..." >&2
125
- sleep $RETRY_DELAY
126
- ((attempt++))
127
- else
128
- echo "Bito call successful on attempt $attempt." >&2
129
- echo "$output"
130
- update_token_usage "$input_text" "$output"
131
- return 0
132
- fi
133
- done
134
-
135
- echo "Failed to call Bito after $MAX_RETRIES attempts. $error_message" >&2
136
- return 1
137
- }
138
-
139
- function create_module_documentation() {
140
- local path_to_module="$1"
141
- local documentation_directory="$2"
142
- echo "Generating documentation for the module at $path_to_module..." >&2
143
-
144
- if is_skippable "$path_to_module"; then
145
- echo "Skipped $path_to_module as it's on the exclusion list."
146
- return
147
- fi
148
-
149
- local name_of_module=$(basename "$path_to_module")
150
- local content_of_module=$(<"$path_to_module")
151
-
152
- local high_level_documentation
153
- high_level_documentation=$(call_bito_with_retry "Module: $name_of_module\n---\n$content_of_module" "$prompt_folder/high_level_doc_prompt.txt" "High-level documentation creation failed for module: $name_of_module")
154
- local ret_code=$?
155
- if ! bito_response_ok "$ret_code" "$high_level_documentation"; then
156
- echo "High-level documentation creation failed for module: $name_of_module"
157
- return 1
158
- fi
159
-
160
- update_token_usage "$content_of_module" "$high_level_documentation"
161
-
162
- local markdown_documentation_file="$documentation_directory/${name_of_module}_Doc.md"
163
- echo -e "## Module: $name_of_module\n$high_level_documentation" >> "$markdown_documentation_file"
164
-
165
- # Generate the flow chart for the module
166
- generate_flow_chart "$path_to_module" "$documentation_directory/flowmaps"
167
-
168
- # Add link to the flow chart in the documentation
169
- local flow_chart_name=$(basename "$path_to_module" | cut -f 1 -d '.')
170
- echo -e "\n![Flow Chart of $flow_chart_name](./flowmaps/${flow_chart_name}_FlowChart.png)\n" >> "$markdown_documentation_file"
171
-
172
- echo -e "Documentation saved to $markdown_documentation_file\n\n" >&2
173
- }
174
-
175
- function extract_module_details_and_call_bito() {
176
- local filename=$1 prompt_file_path=$2 lines=() current_module="" current_objectives="" current_operational_sequence="" capture_objectives=false capture_operational_sequence=false combined_output=""
177
-
178
- echo "Compiling objectives and details for module in $filename..." >&2
179
-
180
- while IFS= read -r line; do lines+=("$line"); done < "$filename"
181
-
182
- for line in "${lines[@]}"; do
183
- if [[ $line =~ ^##\ Module:\ (.*) ]]; then
184
- if [[ -n $current_module ]]; then
185
- echo "Processing module: $current_module with objectives and operational sequence" >&2
186
- combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\nOperational Sequence:\n$current_operational_sequence\n\n"
187
- fi
188
- current_module=${BASH_REMATCH[1]}
189
- current_objectives="" current_operational_sequence=""
190
- capture_objectives=false capture_operational_sequence=false
191
- elif [[ $line =~ ^-\ \*\*Primary\ Objectives\*\*: ]]; then
192
- capture_objectives=true
193
- capture_operational_sequence=false
194
- current_objectives+=$(echo $line | sed 's/.*\*\*Primary Objectives\*\*: //')$'\n'
195
- elif [[ $line =~ ^-\ \*\*Operational\ Sequence\*\*: ]]; then
196
- capture_operational_sequence=true
197
- capture_objectives=false
198
- current_operational_sequence+=$(echo $line | sed 's/.*\*\*Operational Sequence\*\*: //')$'\n'
199
- elif $capture_objectives && [[ $line =~ ^-\ .+ ]]; then
200
- current_objectives+=$(echo $line | sed 's/^-\ //')$'\n'
201
- elif $capture_operational_sequence && [[ $line =~ ^-\ .+ ]]; then
202
- current_operational_sequence+=$(echo $line | sed 's/^-\ //')$'\n'
203
- elif [[ $line == "## "* || $line == "" ]]; then
204
- capture_objectives=false capture_operational_sequence=false
205
- fi
206
- done
207
-
208
- if [[ -n $current_module ]]; then
209
- echo "Processing module: $current_module with objectives and operational sequence" >&2
210
- combined_output+="Module: $current_module\n---\nPrimary Objectives:\n$current_objectives\nOperational Sequence:\n$current_operational_sequence\n\n"
211
- fi
212
-
213
- if bito_output=$(call_bito_with_retry "$combined_output" "$prompt_file_path" "Failed for module: $current_module"); then
214
- echo "Bito call successful for module: $current_module" >&2
215
- echo "$bito_output"
216
- update_token_usage "$combined_output" "$bito_output"
217
- else
218
- echo "Failed to call bito for module: $current_module with adequate content." >&2
219
- return 1
220
- fi
221
- }
222
-
223
- function create_find_command() {
224
- local lang_file="$1"
225
- local folder_to_document="$2"
226
- echo "Assembling command to locate relevant files in $folder_to_document..." >&2
227
- local find_command="find \"$folder_to_document\" -type f"
228
-
229
- while IFS= read -r ext; do
230
- find_command="$find_command -o -name \"*.$ext\""
231
- done < "$lang_file"
232
-
233
- find_command="${find_command/-o /\\( } \)"
234
- echo "$find_command"
235
- }
236
-
237
- function generate_flow_chart() {
238
- local module_file="$1"
239
- local flowchart_folder="$2"
240
-
241
- # Check if the flowchart folder exists, if not, create it
242
- if [ ! -d "$flowchart_folder" ]; then
243
- echo "Creating flowchart directory: $flowchart_folder"
244
- mkdir -p "$flowchart_folder"
245
- fi
246
-
247
- # Define the name of the flow chart file based on the module name
248
- local module_name=$(basename "$module_file" | cut -f 1 -d '.')
249
- local flowchart_file="$flowchart_folder/${module_name}_FlowChart.png"
250
-
251
- # Call code2flow to generate the flow chart
252
- code2flow "$module_file" -o "$flowchart_file" --hide-legend --no-trimming --verbose --skip-parse-errors
253
-
254
- # Check if the flow chart was successfully generated
255
- if [ -f "$flowchart_file" ]; then
256
- echo "Flow chart created for module: $module_name"
257
- else
258
- echo "Failed to create flow chart for module: $module_name" >&2
259
- fi
260
- }
261
-
262
- function generate_flow_chart_for_system() {
263
- local source_folder="$1"
264
- local output_file="$2"
265
-
266
- # Check if the source folder exists
267
- if [ ! -d "$source_folder" ]; then
268
- echo "Source folder $source_folder does not exist" >&2
269
- return 1
270
- fi
271
-
272
- # Check if the output directory exists, if not, create it
273
- local output_dir=$(dirname "$output_file")
274
- if [ ! -d "$output_dir" ]; then
275
- echo "Creating directory for system flowchart: $output_dir"
276
- mkdir -p "$output_dir"
277
- fi
278
-
279
- # Generate a flowchart for the entire system
280
- echo "Generating system flowchart..."
281
- code2flow "$source_folder" -o "$output_file" --hide-legend --no-trimming --verbose --skip-parse-errors
282
-
283
- # Check if the flowchart was successfully generated
284
- if [ -f "$output_file" ]; then
285
- echo "System flowchart created successfully"
286
- else
287
- echo "Failed to create system flowchart" >&2
288
- return 1
289
- fi
290
- }
291
-
292
- # Capture Start Time
293
- start_time=$(date +%s)
294
-
295
- function main() {
296
- echo "Verifying prerequisites before documentation generation..." >&2
297
-
298
- # Check if required tools and files are present
299
- check_tools_and_files
300
-
301
- # Check if a folder name is provided as a command line argument
302
- if [ $# -eq 0 ]; then
303
- echo "Please provide a folder name as a command line argument" >&2
304
- exit 1
305
- fi
306
-
307
- folder_to_document="$1"
308
- docs_folder="doc_"$(basename "$folder_to_document")
309
-
310
- # Check if the folder to document exists
311
- if [ ! -d "$folder_to_document" ]; then
312
- echo "Folder $folder_to_document does not exist" >&2
313
- exit 1
314
- fi
315
-
316
- # Create a directory for the generated documentation if it doesn't exist
317
- if [ ! -d "$docs_folder" ]; then
318
- mkdir "$docs_folder"
319
- fi
320
-
321
- # Read the skip list from the CSV file
322
- read_skip_list
323
-
324
- # Define the path to the aggregated markdown file
325
- aggregated_md_file="$docs_folder/High_Level_Doc.md"
326
-
327
- # Clear existing aggregated markdown file if it exists
328
- [ -f "$aggregated_md_file" ] && > "$aggregated_md_file"
329
-
330
- # Use create_find_command to dynamically generate the find command with specified extensions
331
- module_files=$(eval $(create_find_command "$lang_csv" "$folder_to_document"))
332
-
333
- # Check if module_files is empty and display a warning if no files are found
334
- if [ -z "$module_files" ]; then
335
- echo "Warning: No files found for documentation generation." >&2
336
- return
337
- fi
338
-
339
- # Generate high-level documentation for each found module file
340
- for module_file in $module_files; do
341
- # Create documentation for the module, including flow chart
342
- create_module_documentation "$module_file" "$docs_folder"
343
- done
344
-
345
- # Aggregate individual markdown files into a main document
346
- echo "# Module Overview" > "$aggregated_md_file"
347
- for md_file in "$docs_folder"/*_Doc.md; do
348
- if [ "$md_file" != "$aggregated_md_file" ]; then
349
- cat "$md_file" >> "$aggregated_md_file"
350
- fi
351
- done
352
-
353
- local introduction_and_summary=$(extract_module_details_and_call_bito "$aggregated_md_file" "$prompt_folder/system_introduction_prompt.txt")
354
-
355
- # Prepend the introduction and summary to the aggregated Markdown file
356
- local temp_file=$(mktemp)
357
- mv "$aggregated_md_file" "$temp_file"
358
- echo -e "# Introduction :\n" > "$aggregated_md_file"
359
- echo "$introduction_and_summary" >> "$aggregated_md_file"
360
-
361
- # Generate and append the system flow chart
362
- generate_flow_chart_for_system "$folder_to_document" "$docs_folder/flowmaps/system_flowchart.png"
363
- echo -e "\n# System Flowchart\n\n![System Flowchart](./flowmaps/system_flowchart.png)\n" >> "$aggregated_md_file"
364
-
365
- # Append the rest of the original aggregated content
366
- cat "$temp_file" >> "$aggregated_md_file"
367
- rm "$temp_file"
368
-
369
- # Log session duration and token usage
370
- log_token_usage_and_session_duration
371
-
372
- echo "Documentation generated in $docs_folder"
373
- }
374
-
375
- main "$@"
376
-
377
- ### Response:
378
- ```mermaid
379
- graph
 
1
  ---
2
  license: cc-by-nc-sa-4.0
3
  ---
4
+ See Model Card from MermaidMistral or MermaidLLama or MermaidStable3B for more information, this is the same dataset applied to the Solar 10.7B Base Model,
5
 
6
+ Interesting findings is that the hand curated 800 examples I made of as diverse edge cases I could come up with seem to still improve the models ability,
7
+ Which shows both in the training loss and eval loss trends as they continue to get closer to 0 together, with the eval loss at roughly the same as training loss values.
8
 
9
+ Problem: My my girlfriend pays the PGE bill so I gotta cool it after releasing 5 models this month, the space heater I call an AI Workstation needs a break. :P
 
10
 
11
+ Example of how to use my model provided below:
12
+ https://huggingface.co/TroyDoesAI/MermaidSolar/blob/main/example_of_how_to_use_my_model_requires_response_to_include_the_cue_tripleTicknewlinegraph_then_LR_RL_TD_TB_to_select_various_types_of_graphs_it_knows.txt