Spaces:
Paused
Paused
Download multipurpose_chatbot/globals.py from SeaLLMs/SeaLLM-Chat: direct link, hf CLI and curl.
- Browser
- Download file 892 Bytes
-
https://huggingface.co/spaces/SeaLLMs/SeaLLM-Chat/resolve/main/multipurpose_chatbot/globals.py
- Command line
-
hf download hf://spaces/SeaLLMs/SeaLLM-Chat/multipurpose_chatbot/globals.py
-
curl -L -o globals.py https://huggingface.co/spaces/SeaLLMs/SeaLLM-Chat/resolve/main/multipurpose_chatbot/globals.py
892 Bytes
| import os | |
| global MODEL_ENGINE | |
| from multipurpose_chatbot.engines import load_multipurpose_chatbot_engine | |
| from multipurpose_chatbot.demos import get_demo_class | |
| from .configs import ( | |
| BACKEND, | |
| RAG_EMBED_MODEL_NAME, | |
| ) | |
| MODEL_ENGINE = load_multipurpose_chatbot_engine(BACKEND) | |
| RAG_CURRENT_FILE, RAG_EMBED, RAG_CURRENT_VECTORSTORE = None, None, None | |
| def load_embeddings(): | |
| global RAG_EMBED | |
| if RAG_EMBED is None: | |
| from langchain_community.embeddings import HuggingFaceEmbeddings, HuggingFaceBgeEmbeddings | |
| print(f'LOading embeddings: {RAG_EMBED_MODEL_NAME}') | |
| RAG_EMBED = HuggingFaceEmbeddings(model_name=RAG_EMBED_MODEL_NAME, model_kwargs={'trust_remote_code':True, "device": "cpu"}) | |
| else: | |
| print(f'RAG_EMBED ALREADY EXIST: {RAG_EMBED_MODEL_NAME}: {RAG_EMBED=}') | |
| return RAG_EMBED | |
| def get_rag_embeddings(): | |
| return load_embeddings() | |