try n_thread=4
Browse files- .gitignore +4 -0
- app/core/config.py +1 -1
- app/services/engine.py +1 -1
- test.ipynb +13 -13
.gitignore
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
.vscode/
|
| 3 |
+
|
| 4 |
+
*.ipynb
|
app/core/config.py
CHANGED
|
@@ -12,6 +12,6 @@ class Settings(BaseSettings):
|
|
| 12 |
|
| 13 |
# CPU constraints for HF Free Space
|
| 14 |
N_CTX: int = 2048
|
| 15 |
-
N_THREADS: int =
|
| 16 |
|
| 17 |
settings = Settings()
|
|
|
|
| 12 |
|
| 13 |
# CPU constraints for HF Free Space
|
| 14 |
N_CTX: int = 2048
|
| 15 |
+
N_THREADS: int = 4
|
| 16 |
|
| 17 |
settings = Settings()
|
app/services/engine.py
CHANGED
|
@@ -18,7 +18,7 @@ class InferenceEngine:
|
|
| 18 |
model_path=settings.MODEL_PATH,
|
| 19 |
n_ctx=settings.N_CTX,
|
| 20 |
n_threads=settings.N_THREADS,
|
| 21 |
-
use_mmap=False,
|
| 22 |
verbose=False
|
| 23 |
)
|
| 24 |
|
|
|
|
| 18 |
model_path=settings.MODEL_PATH,
|
| 19 |
n_ctx=settings.N_CTX,
|
| 20 |
n_threads=settings.N_THREADS,
|
| 21 |
+
use_mmap=False, # it force to load all the weights in the RAM (if True then store in the Disk)
|
| 22 |
verbose=False
|
| 23 |
)
|
| 24 |
|
test.ipynb
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
},
|
| 19 |
{
|
| 20 |
"cell_type": "code",
|
| 21 |
-
"execution_count":
|
| 22 |
"id": "7a86f8cc",
|
| 23 |
"metadata": {},
|
| 24 |
"outputs": [
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"output_type": "stream",
|
| 28 |
"text": [
|
| 29 |
"--- LangChain Pipeline Stream Output ---\n",
|
| 30 |
-
"How can I assist you today?\n",
|
| 31 |
"\n"
|
| 32 |
]
|
| 33 |
}
|
|
@@ -43,14 +43,14 @@
|
|
| 43 |
")\n",
|
| 44 |
"\n",
|
| 45 |
"print(\"--- LangChain Pipeline Stream Output ---\")\n",
|
| 46 |
-
"for chunk in llm.stream([HumanMessage(content=\"
|
| 47 |
" print(chunk.content, end=\"\", flush=True)\n",
|
| 48 |
"print(\"\\n\")"
|
| 49 |
]
|
| 50 |
},
|
| 51 |
{
|
| 52 |
"cell_type": "code",
|
| 53 |
-
"execution_count":
|
| 54 |
"id": "6ecc6c66",
|
| 55 |
"metadata": {},
|
| 56 |
"outputs": [
|
|
@@ -59,21 +59,21 @@
|
|
| 59 |
"output_type": "stream",
|
| 60 |
"text": [
|
| 61 |
"--- LangChain Pipeline Stream Output ---\n",
|
| 62 |
-
"LLM
|
| 63 |
-
"\n",
|
| 64 |
-
"Some notable LLMs include:\n",
|
| 65 |
"\n",
|
| 66 |
-
"1. **GPT
|
|
|
|
|
|
|
| 67 |
"\n",
|
| 68 |
-
"2. **BERT (Bidirectional Encoder Representations from Transformers)
|
| 69 |
"\n",
|
| 70 |
-
"3. **T5 (Text-
|
| 71 |
"\n",
|
| 72 |
-
"4. **
|
| 73 |
"\n",
|
| 74 |
-
"5. **
|
| 75 |
"\n",
|
| 76 |
-
"These models have revolutionized
|
| 77 |
"\n"
|
| 78 |
]
|
| 79 |
}
|
|
|
|
| 18 |
},
|
| 19 |
{
|
| 20 |
"cell_type": "code",
|
| 21 |
+
"execution_count": 4,
|
| 22 |
"id": "7a86f8cc",
|
| 23 |
"metadata": {},
|
| 24 |
"outputs": [
|
|
|
|
| 27 |
"output_type": "stream",
|
| 28 |
"text": [
|
| 29 |
"--- LangChain Pipeline Stream Output ---\n",
|
| 30 |
+
"I'm doing well! How about you? How can I assist you today?\n",
|
| 31 |
"\n"
|
| 32 |
]
|
| 33 |
}
|
|
|
|
| 43 |
")\n",
|
| 44 |
"\n",
|
| 45 |
"print(\"--- LangChain Pipeline Stream Output ---\")\n",
|
| 46 |
+
"for chunk in llm.stream([HumanMessage(content=\"Hello how are you \")]):\n",
|
| 47 |
" print(chunk.content, end=\"\", flush=True)\n",
|
| 48 |
"print(\"\\n\")"
|
| 49 |
]
|
| 50 |
},
|
| 51 |
{
|
| 52 |
"cell_type": "code",
|
| 53 |
+
"execution_count": 2,
|
| 54 |
"id": "6ecc6c66",
|
| 55 |
"metadata": {},
|
| 56 |
"outputs": [
|
|
|
|
| 59 |
"output_type": "stream",
|
| 60 |
"text": [
|
| 61 |
"--- LangChain Pipeline Stream Output ---\n",
|
| 62 |
+
"As of my knowledge cutoff in October 2023, LLM typically refers to \"Large Language Models.\" These are advanced machine learning models designed to understand, generate, and sometimes translate human language with remarkable accuracy. They are built using deep learning techniques, particularly architectures like Transformers. Some well-known examples of large language models include:\n",
|
|
|
|
|
|
|
| 63 |
"\n",
|
| 64 |
+
"1. **GPT (Generative Pre-trained Transformer) Series**:\n",
|
| 65 |
+
" - **GPT-3**: Released by Microsoft in June 2020, it features 175 billion parameters and is known for its ability to generate coherent and contextually relevant text.\n",
|
| 66 |
+
" - **GPT-4**: Microsoft released this iteration in March 2023, building upon GPT-3's architecture and features to further enhance language understanding and generation capabilities.\n",
|
| 67 |
"\n",
|
| 68 |
+
"2. **BERT (Bidirectional Encoder Representations from Transformers)**: Developed by Google, BERT is designed to understand the context of words in search queries by considering the words that come before and after each word in the sentence. BERT has various versions like BERT-large, BERT-base, etc.\n",
|
| 69 |
"\n",
|
| 70 |
+
"3. **T5 (Text-to-Text Transfer Transformer)**: Created by Google, T5 treats all NLP tasks as text-to-text problems, transforming them into a unified framework. It is known for its versatility and efficiency.\n",
|
| 71 |
"\n",
|
| 72 |
+
"4. **PaLM (Pathways Language Model)**: Developed by Google, PaLM is a smaller but highly efficient version of their original model. It was released in October 2023 and has demonstrated impressive performance across a wide range of language tasks, including math and science reasoning.\n",
|
| 73 |
"\n",
|
| 74 |
+
"5. **Phi (Phi-2)**: Developed by Microsoft, Phi-2 is a smaller and more efficient language model compared to some of its predecessors. It is designed to provide high performance while using significantly less computational power.\n",
|
| 75 |
"\n",
|
| 76 |
+
"These large language models have revolutionized fields such as natural language processing (NLP), conversational AI, content generation, and many others. They are trained on vast datasets comprising diverse forms of text, enabling them to understand and generate human-like text with high accuracy. As research and development in this area continue, we can expect even more powerful and versatile language models in the future.\n",
|
| 77 |
"\n"
|
| 78 |
]
|
| 79 |
}
|