Last active
March 11, 2024 18:27
Revisions
-
smellslikeml revised this gist
Mar 11, 2024 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ # Launch nats-server # wget https://huggingface.co/remyxai/stablelm-zephyr-3B_localmentor/resolve/main/ggml-model-q4_0.gguf -o stablelm-localmentor_2.gguf import nats import asyncio from llama_cpp import Llama -
smellslikeml revised this gist
Mar 11, 2024 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ # Launch nats-server # Download weights from https://huggingface.co/remyxai/stablelm-zephyr-3B_localmentor/blob/main/ggml-model-q4_0.gguf # to stablelm-localmentor.gguf import nats import asyncio from llama_cpp import Llama -
smellslikeml revised this gist
Mar 11, 2024 . No changes.There are no files selected for viewing
-
smellslikeml created this gist
Mar 11, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ import nats import asyncio from llama_cpp import Llama async def llm_runner(nats_url, model_path, subject): nc = await nats.connect(nats_url) llm = Llama(model_path) async def inference_handler(msg): data = msg.data.decode() response = llm(data, max_tokens=2048, stop=["###", "\n\n"], echo=True) r = response["choices"][0]["text"] await nc.publish(msg.reply, str(r).encode()) await nc.subscribe(subject, cb=inference_handler) await asyncio.Future() if __name__ == "__main__": asyncio.run( llm_runner( "nats://localhost:4222", "stablelm-localmentor.gguf", "inference.requests" ) )