Create __init__.py
Browse files- __init__.py +75 -0
__init__.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from langchain.document_loaders import (
|
3 |
+
CSVLoader,
|
4 |
+
EverNoteLoader,
|
5 |
+
PDFMinerLoader,
|
6 |
+
TextLoader,
|
7 |
+
UnstructuredEPubLoader,
|
8 |
+
UnstructuredHTMLLoader,
|
9 |
+
UnstructuredMarkdownLoader,
|
10 |
+
UnstructuredODTLoader,
|
11 |
+
UnstructuredPowerPointLoader,
|
12 |
+
UnstructuredWordDocumentLoader,
|
13 |
+
)
|
14 |
+
|
15 |
+
|
16 |
+
FAVICON_PATH: str = 'https://github.com/agladsoft/LocalChatGPT/blob/main/sclogo1.png?raw=true'
|
17 |
+
SYSTEM_PROMPT: str = "Ты — Сайга, русскоязычный автоматический ассистент. Ты разговариваешь с людьми и помогаешь им."
|
18 |
+
SYSTEM_TOKEN: int = 1788
|
19 |
+
USER_TOKEN: int = 1404
|
20 |
+
BOT_TOKEN: int = 9225
|
21 |
+
LINEBREAK_TOKEN: int = 13
|
22 |
+
|
23 |
+
ROLE_TOKENS: dict = {
|
24 |
+
"user": USER_TOKEN,
|
25 |
+
"bot": BOT_TOKEN,
|
26 |
+
"system": SYSTEM_TOKEN
|
27 |
+
}
|
28 |
+
|
29 |
+
LOADER_MAPPING: dict = {
|
30 |
+
".csv": (CSVLoader, {}),
|
31 |
+
".doc": (UnstructuredWordDocumentLoader, {}),
|
32 |
+
".docx": (UnstructuredWordDocumentLoader, {}),
|
33 |
+
".enex": (EverNoteLoader, {}),
|
34 |
+
".epub": (UnstructuredEPubLoader, {}),
|
35 |
+
".html": (UnstructuredHTMLLoader, {}),
|
36 |
+
".md": (UnstructuredMarkdownLoader, {}),
|
37 |
+
".odt": (UnstructuredODTLoader, {}),
|
38 |
+
".pdf": (PDFMinerLoader, {}),
|
39 |
+
".ppt": (UnstructuredPowerPointLoader, {}),
|
40 |
+
".pptx": (UnstructuredPowerPointLoader, {}),
|
41 |
+
".txt": (TextLoader, {"encoding": "utf8"}),
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
DICT_REPO_AND_MODELS: dict = {
|
46 |
+
"https://huggingface.co/IlyaGusev/saiga2_7b_gguf/resolve/main/model-q2_K.gguf":
|
47 |
+
"saiga2_7b_gguf/model-q2_K.gguf",
|
48 |
+
"https://huggingface.co/IlyaGusev/saiga2_7b_gguf/resolve/main/model-q4_K.gguf":
|
49 |
+
"saiga2_7b_gguf/model-q4_K.gguf",
|
50 |
+
"https://huggingface.co/IlyaGusev/saiga2_7b_gguf/resolve/main/model-q8_0.gguf":
|
51 |
+
"saiga2_7b_gguf/model-q8_0.gguf",
|
52 |
+
"https://huggingface.co/IlyaGusev/saiga2_13b_gguf/resolve/main/model-q4_K.gguf":
|
53 |
+
"saiga2_13b_gguf/model-q4_K.gguf",
|
54 |
+
# "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q2_K.gguf":
|
55 |
+
# "llama-2-7b-chat.Q2_K.gguf",
|
56 |
+
# "https://huggingface.co/TheBloke/OpenBuddy-Llama2-13B-v11.1-GGUF/resolve/main/openbuddy-llama2-13b-v11.1.Q2_K.gguf":
|
57 |
+
# "openbuddy-llama2-13b-v11.1.Q2_K.gguf",
|
58 |
+
}
|
59 |
+
|
60 |
+
EMBEDDER_NAME: str = "sentence-transformers/paraphrase-multilingual-mpnet-base-v2"
|
61 |
+
|
62 |
+
MAX_NEW_TOKENS: int = 1500
|
63 |
+
|
64 |
+
ABS_PATH = os.path.dirname(os.path.abspath(__file__))
|
65 |
+
MODELS_DIR = os.path.join(ABS_PATH, "../models")
|
66 |
+
AUTH_FILE = os.path.join(ABS_PATH, "auth.csv")
|
67 |
+
|
68 |
+
|
69 |
+
BLOCK_CSS = """
|
70 |
+
|
71 |
+
#buttons button {
|
72 |
+
min-width: min(120px,100%);
|
73 |
+
}
|
74 |
+
|
75 |
+
"""
|