diff --git a/examples/assistant.py b/examples/assistant.py deleted file mode 100644 index 7cf89e1..0000000 --- a/examples/assistant.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -''' -Chat with a sophisticated AI assistant. -''' - -from blowtorch import client - -client( model_file='Meta-Llama-3-8B-Instruct.Q2_K.gguf', - hugging_face_path='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF', - chat_format="llama-3", - name='AI Assistant', - device='cpu', - max_new_tokens = 1000, - context_length = 6000 -).chat( - max_new_tokens=512, - char_tags=[ - 'polite', - 'focused and helpful', - 'expert in programing', - 'obedient' - ], - username='Human', - temperature=0.8, - repetition_penalty=1.3 -) \ No newline at end of file diff --git a/examples/bidenObamaTrump.py b/examples/bidenObamaTrump.py deleted file mode 100644 index ca9af9d..0000000 --- a/examples/bidenObamaTrump.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 - -''' -Generates a realistic group chat between Biden, Obama and Trump. -The presidents joke around and roast each other. -''' -from blowtorch import client - -if __name__ == '__main__': - print(client(model_file='Meta-Llama-3-8B-Instruct.Q2_K.gguf', - hugging_face_path='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF', - chat_format="llama-3", - device='cpu').inference( - "Generate a trialog between Biden, Trump and Obama in a group chat. The presidents should joke around related topics, roast and insult each other in a subtle way with real references, and the format should obey the scheme Joe: ... Donald: ... Obama: ..., no prologue just start directly with the conversation.", - do_sample=True, - temperature=0.8, - repetition_penalty=1.1)[0]['generated_text']) \ No newline at end of file diff --git a/examples/chatGPT.py b/examples/chatGPT.py deleted file mode 100644 index 7a8ce4a..0000000 --- a/examples/chatGPT.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python3 - -''' -Creates GPT chat in web browser. -Will be reachable at http://localhost:3000/ -''' - - -from blowtorch import client, webUI - -cl = client(model_file='Meta-Llama-3-8B-Instruct.Q2_K.gguf', - hugging_face_path='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF', - chat_format="llama-3", - name='GPT', - device='cpu', - context_length = 6000) - -cl.setConfig( - char_tags=[ - 'skilled like chat GPT', - 'high performance', - 'accurate', - 'problem-solving', - 'answer in markdown format', - 'kind', - 'eloquent', - 'genuine' - ], - username='User', - temperature=0.85, - repetition_penalty=1.15 -) - -# cl.chat() -webUI(cl, port=3000) \ No newline at end of file diff --git a/examples/gpt-llama-3-8B-cpu.py b/examples/gpt-llama-3-8B-cpu.py deleted file mode 100644 index 67481c7..0000000 --- a/examples/gpt-llama-3-8B-cpu.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 - -''' -An example of LLaMA-3-8B GGUF model with GPT-like chat. -The GPT can chat with a user whose name can be provided. -Will be reachable at http://localhost:3000/ -''' - -from blowtorch import client, webUI, console - -USERNAME = 'Steve' - -cl = client('Meta-Llama-3-8B-Instruct.Q2_K.gguf', - 'MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF', - name='Llama-GPT', - device='cpu', - chat_format="llama-3", - n_ctx=2048) - -cl.setConfig( - char_tags=[ - 'skilled like chat GPT', - 'high performance', - 'accurate', - 'problem-solving', - 'eloquent', - 'genuine' - ], - username=USERNAME, - temperature=1.1, - max_new_tokens=512, - auto_trim = True -) - -# expose chat to browser -console(cl) \ No newline at end of file diff --git a/examples/gpt-llama-3-8B-gpu.py b/examples/gpt-llama-3-8B-gpu.py deleted file mode 100644 index 5e5a6ef..0000000 --- a/examples/gpt-llama-3-8B-gpu.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 - -''' -An example of LLaMA-3-8B GPTQ model (suitable for GPU) with GPT-like chat. -The GPT will refer to the user name provided. -Will be reachable at http://localhost:3000/ -''' - -from blowtorch import client, webUI, console - -USERNAME = input('Please enter your name:') - -cl = client(hugging_face_path='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GPTQ', - name='LlamaGPT', - device='gpu', - chat_format="llama-3") - -cl.setConfig( - char_tags=[ - 'skilled like chat GPT', - 'high performance', - 'accurate', - 'problem-solving', - 'eloquent', - 'genuine' - ], - username=USERNAME, - temperature=1.1, - max_new_tokens=256 -) - -# expose chat to browser -console(cl) \ No newline at end of file diff --git a/examples/llama3_GPT_CPU_console.py b/examples/llama3_8B_gpt_cpu_console.py similarity index 100% rename from examples/llama3_GPT_CPU_console.py rename to examples/llama3_8B_gpt_cpu_console.py diff --git a/examples/llama3_GPT_GPU_console.py b/examples/llama3_8B_gpt_gpu_console.py similarity index 100% rename from examples/llama3_GPT_GPU_console.py rename to examples/llama3_8B_gpt_gpu_console.py diff --git a/examples/vllm_gpt.py b/examples/llama3_8B_gpt_vllm_console.py similarity index 65% rename from examples/vllm_gpt.py rename to examples/llama3_8B_gpt_vllm_console.py index 67a43a0..361041f 100644 --- a/examples/vllm_gpt.py +++ b/examples/llama3_8B_gpt_vllm_console.py @@ -1,7 +1,12 @@ +#!/usr/bin/env python3 + +''' +A GPT-like example of LLama-3-8B chat accelerated with vLLM's flash-attn. backend. +''' from blowtorch import client, console chat_bot = client(hugging_face_path='MaziyarPanahi/Meta-Llama-3-8B-Instruct-GPTQ', - attention=True, + attention=True, # setting attention to true name='llama-bot', chat_format='llama-3', device='gpu') diff --git a/examples/yoda.py b/examples/llama3_8B_yoda_scenario_cpu_webui.py similarity index 89% rename from examples/yoda.py rename to examples/llama3_8B_yoda_scenario_cpu_webui.py index 46cab1c..a164f67 100644 --- a/examples/yoda.py +++ b/examples/llama3_8B_yoda_scenario_cpu_webui.py @@ -12,8 +12,8 @@ from blowtorch import client, console, webUI -cl = client('llama-2-7b-chat.Q2_K.gguf', - 'TheBloke/Llama-2-7B-Chat-GGUF', +cl = client('Meta-Llama-3-8B-Instruct.Q2_K.gguf', + 'MaziyarPanahi/Meta-Llama-3-8B-Instruct-GGUF', name='Yoda', device='cpu', model_type="llama", @@ -29,5 +29,4 @@ top_k=60, ) -webUI(cl) -# console(cl) \ No newline at end of file +webUI(cl) \ No newline at end of file diff --git a/examples/mistral.py b/examples/mistral_7B_gpt_cpu_webui.py similarity index 100% rename from examples/mistral.py rename to examples/mistral_7B_gpt_cpu_webui.py diff --git a/examples/scenario.py b/examples/scenario.py deleted file mode 100644 index affc6ed..0000000 --- a/examples/scenario.py +++ /dev/null @@ -1,33 +0,0 @@ -''' -An blowtorch example for setting up a scenario. -Besides just providing char_tags to give your chat bot attributes or shape his character a bit, -blowtorch also provides a more in-depth scenario to give users more freedom to create their main frame. -''' - - -myScenario = '''You will play the role of Bowser from Super Mario who has trapped princess Peach in his castle and I am Super Mario who has just entered the castle and eager to rescue Peach. -Then we take it out in a serious rap battle, where we roast ourselves. There are Koopas and Mushrooms around acting as a crowd for ambience. Suddenly after my crunchy -line about your weight you realize your defeat and you let Peach go, after we leave you burn a castle.''' - - - -from blowtorch import client, console, webUI - -cl = client('llama-2-7b-chat.Q2_K.gguf', - 'TheBloke/Llama-2-7B-Chat-GGUF', - name='Bowser', - device='cpu', - model_type="llama", - context_length = 6000) - -cl.setConfig( - max_new_tokens=128, - scenario=myScenario, # <-- add the scenario to config instead of char_tags - username='Mario', - temperature=0.85, - repetition_penalty=1.15, - top_p=0.95, - top_k=60, -) - -console(cl) \ No newline at end of file diff --git a/examples/vicuna7B.py b/examples/vicuna7B.py deleted file mode 100644 index eba2d75..0000000 --- a/examples/vicuna7B.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 - -''' -How to get Vicuna-7B in GPTQ format to run. -Please see the client arguments. -''' - -from blowtorch import client, webUI - -cl = client(hugging_face_path='TheBloke/Wizard-Vicuna-7B-Uncensored-GPTQ', - name='GPT', - device='gpu', - trust_remote_code=True, - revision="main") - -cl.setConfig( - username='User', - temperature=0.8, - repetition_penalty=1.1 -) - -# cl.chat() -webUI(cl) \ No newline at end of file