Skip to content

Commit

Permalink
2024-08-23 17:11:29.423101 new snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardocerqueira committed Aug 23, 2024
1 parent 9698388 commit 9fd3943
Show file tree
Hide file tree
Showing 14 changed files with 363 additions and 413 deletions.
28 changes: 28 additions & 0 deletions seeker/report.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
--------------------------------------------------------------------------------
2024-08-23 17:11:29.423101
--------------------------------------------------------------------------------
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: snippet/aspen_dental_program_model.py
deleted: snippet/firefox-bookmarks-jq.sh
deleted: snippet/fucking_stupid_ass_programming_language.py
deleted: snippet/main.py
deleted: snippet/puissance4-console.py
deleted: snippet/totp.py

Untracked files:
(use "git add <file>..." to include in what will be committed)
snippet/install-mysql-0.5.6.sh
snippet/llm_benchmark.py
snippet/music_visualizer.py
snippet/receive.go
snippet/send.go
snippet/trading_service.py
snippet/train.sh

no changes added to commit (use "git add" and/or "git commit -a")

--------------------------------------------------------------------------------
2024-08-22 17:12:27.636388
--------------------------------------------------------------------------------
Expand Down
191 changes: 0 additions & 191 deletions seeker/snippet/aspen_dental_program_model.py

This file was deleted.

10 changes: 0 additions & 10 deletions seeker/snippet/firefox-bookmarks-jq.sh

This file was deleted.

69 changes: 0 additions & 69 deletions seeker/snippet/fucking_stupid_ass_programming_language.py

This file was deleted.

5 changes: 5 additions & 0 deletions seeker/snippet/install-mysql-0.5.6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#date: 2024-08-23T17:01:14Z
#url: https://api.github.com/gists/811589676080319d4767a2d381781eda
#owner: https://api.github.com/users/ghoppe

gem install mysql2 -v '0.5.6' -- --with-mysql-config=$(brew --prefix mysql)/bin/mysql_config --with-ldflags="-L$(brew --prefix zstd)/lib -L$(brew --prefix openssl)/lib" --with-cppflags=-I$(brew --prefix openssl)/include
86 changes: 86 additions & 0 deletions seeker/snippet/llm_benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#date: 2024-08-23T17:10:11Z
#url: https://api.github.com/gists/7d4a6d6169f2c16a28bb994df7d3fd7e
#owner: https://api.github.com/users/TheMasterFX

import pandas as pd
from openai import OpenAI

OPENAI_API_BASE='http://192.168.178.34:11434/v1'
OPENAI_MODEL_NAME='dolphin-mistral:latest' # Adjust based on available model\n",
OPENAI_API_KEY='IHAVENOKEY'

# Set your OpenAI API key
client = OpenAI(base_url=OPENAI_API_BASE, api_key=OPENAI_API_KEY)

system_prompt = "You are a helpful assistant."

# Define prompts
prompts = [
"There are three killers in a room. Someone enters the room and kills one of them. Nobody leaves the room. How many killers are left in the room? Explain your reasoning step by step.",
"What is 20 + 4*3 - 2?",
"Which number is bigger: 9.11 or 9.9?",
"What is the diameter of the earth?",
"What is the diameter of the mars?",
"What is the diameter of the sun?",
"Give me this sequence in reverse: fpoiidnooi",
"I have 2 apples, then I buy 2 more. I bake a pie with 2 of the apples. After eating half of the pie how many apples do I have left?",
"Is it acceptable to gently push a randmom person if it could save humanity from extinction?",
"Dies ist ein test in Deutsch. Beschreibe die Relativitätstheorie in den Worten für ein 6 Jähriges Kind!"
# Add more prompts...
]

def build_conversation(user_message):
return [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_message}
]

# Define LLMs
models = {
"Dolphin-Mistral": "dolphin-mistral:latest",
"Dolphin-Llama3": "dolphin-llama3:latest",
"Phi-3 3.8B": "phi3:latest",
"Phi-3.5 3.8B": "phi3.5:latest",
"Lllama3 8B": "llama3:latest",
"Gemma 2 9B": "gemma2:latest",
"Qwen 0.5B": "qwen2:0.5b",
"Lllama3.1 8B": "llama3.1:latest"
# Add more models...qwen2:0.5b
}

# Check if there's a saved DataFrame, if not, initialize an empty one
try:
results = pd.read_csv("llm_benchmark_results.csv",sep=';', index_col="Prompt")
except FileNotFoundError:
results = pd.DataFrame(index=prompts, columns=models.keys())

# Add new prompts if they are not already in the DataFrame
new_prompts = [prompt for prompt in prompts if prompt not in results.index]
for prompt in new_prompts:
results.loc[prompt] = None

new_models = [model for model in models if model not in results.columns]
for model in new_models:
results[model] = None

# Loop through prompts and models
for prompt in prompts:
for model_name, model_id in models.items():
# Skip if the result for this prompt and model is already calculated
if pd.notna(results.at[prompt, model_name]):
continue
conversation = build_conversation(prompt)
# Generate text using the OpenAI API
generated_text = client.chat.completions.create(
model=model_id,
messages=conversation,
max_tokens= "**********"
).choices[0].message.content

# Store result in DataFrame
results.at[prompt, model_name] = generated_text

# Export results to CSV
results.to_csv("llm_benchmark_results.csv",sep=';', index_label="Prompt")
results.to_excel("llm_benchmark_results.xlsx", index_label="Prompt")

Loading

0 comments on commit 9fd3943

Please sign in to comment.