From b439fa0942e79913e7b65619af0fc0f83eba88e5 Mon Sep 17 00:00:00 2001 From: Richard Anthony Hein Date: Thu, 22 Aug 2024 14:33:43 +0000 Subject: [PATCH] updated readme, fix paths for imports after moving to playground demos --- playground/demos/chatbot/README.md | 13 ++++++++++++- playground/demos/chatbot/server/__init__.py | 2 +- playground/demos/chatbot/server/requirements.txt | 3 +++ playground/demos/chatbot/server/server.py | 6 +++--- playground/demos/chatbot/server/vector_store.py | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 playground/demos/chatbot/server/requirements.txt diff --git a/playground/demos/chatbot/README.md b/playground/demos/chatbot/README.md index 01f8611d..af25f803 100644 --- a/playground/demos/chatbot/README.md +++ b/playground/demos/chatbot/README.md @@ -18,7 +18,18 @@ In theory, any OpenAI compatible LLM endpoint is supported via the OpenAIChatLLM ### Quickstart -* Start vLLM using Docker container by running the [dockerRunVllm](./server/dockerRunVllm.sh). Adjust the script to select your desired model and set the HUGGING_FACE_HUB_TOKEN. +* Start vLLM using GPUs using Docker container by running the [dockerRunVllm](./server/dockerRunVllm.sh). Adjust the script to select your desired model and set the HUGGING_FACE_HUB_TOKEN. + +** For CPU support (not recommended for vLLM), build and run it in docker using this [Dockerfile](./Dockerfile). +```bash +cd /swarms/playground/demos/chatbot +docker build -t llm-serving:vllm-cpu -f ~/vllm/Dockerfile.cpu . +docker run --rm --env "HF_TOKEN=" \ + --ipc=host \ + -p 8000:8000 \ + llm-serving:vllm-cpu \ + --model NousResearch/Hermes-3-Llama-3.1-8B +``` * Start the Chatbot API Server with the following shell command: diff --git a/playground/demos/chatbot/server/__init__.py b/playground/demos/chatbot/server/__init__.py index 2b7423ff..3d7154bd 100644 --- a/playground/demos/chatbot/server/__init__.py +++ b/playground/demos/chatbot/server/__init__.py @@ -1,4 +1,4 @@ -from swarms.server.vector_store import VectorStorage +from playground.demos.chatbot.server.vector_store import VectorStorage __all__ = [ "VectorStorage", diff --git a/playground/demos/chatbot/server/requirements.txt b/playground/demos/chatbot/server/requirements.txt new file mode 100644 index 00000000..e96ae42f --- /dev/null +++ b/playground/demos/chatbot/server/requirements.txt @@ -0,0 +1,3 @@ +vllm +msgspc +librosa \ No newline at end of file diff --git a/playground/demos/chatbot/server/server.py b/playground/demos/chatbot/server/server.py index dcf7f9c3..7773fbf7 100644 --- a/playground/demos/chatbot/server/server.py +++ b/playground/demos/chatbot/server/server.py @@ -27,9 +27,9 @@ from swarms.prompts.conversational_RAG import ( E_SYS, QA_PROMPT_TEMPLATE_STR, ) -from swarms.server.responses import StreamingResponse -from swarms.server.server_models import ChatRequest -from swarms.server.vector_store import VectorStorage +from playground.demos.chatbot.server.responses import StreamingResponse +from playground.demos.chatbot.server.server_models import ChatRequest +from playground.demos.chatbot.server.vector_store import VectorStorage from swarms.models.popular_llms import OpenAIChatLLM # Explicitly specify the path to the .env file diff --git a/playground/demos/chatbot/server/vector_store.py b/playground/demos/chatbot/server/vector_store.py index b8fa853d..a3fcde55 100644 --- a/playground/demos/chatbot/server/vector_store.py +++ b/playground/demos/chatbot/server/vector_store.py @@ -15,7 +15,7 @@ from langchain.storage import LocalFileStore from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_chroma import Chroma -from swarms.server.async_parent_document_retriever import \ +from playground.demos.chatbot.server.async_parent_document_retriever import \ AsyncParentDocumentRetriever STORE_TYPE = "local" # "redis" or "local"