Spaces:
Configuration error
Configuration error
oremaz
commited on
Commit
·
25b9c20
1
Parent(s):
5aecaaa
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -35,6 +35,7 @@ from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
|
|
| 35 |
from llama_index.core.agent.workflow import AgentWorkflow
|
| 36 |
from llama_index.llms.vllm import Vllm
|
| 37 |
|
|
|
|
| 38 |
# Import all required official LlamaIndex Readers
|
| 39 |
from llama_index.readers.file import (
|
| 40 |
PDFReader,
|
|
@@ -119,21 +120,16 @@ def initialize_models(use_api_mode=False):
|
|
| 119 |
print("Initializing models in non-API mode with local models...")
|
| 120 |
|
| 121 |
try :
|
| 122 |
-
proj_llm =
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
"temperature": 0.6,
|
| 133 |
-
"top_p": 0.95,
|
| 134 |
-
"top_k": 20
|
| 135 |
-
}
|
| 136 |
-
)
|
| 137 |
|
| 138 |
# Code LLM
|
| 139 |
code_llm = HuggingFaceLLM(
|
|
|
|
| 35 |
from llama_index.core.agent.workflow import AgentWorkflow
|
| 36 |
from llama_index.llms.vllm import Vllm
|
| 37 |
|
| 38 |
+
|
| 39 |
# Import all required official LlamaIndex Readers
|
| 40 |
from llama_index.readers.file import (
|
| 41 |
PDFReader,
|
|
|
|
| 120 |
print("Initializing models in non-API mode with local models...")
|
| 121 |
|
| 122 |
try :
|
| 123 |
+
proj_llm = HuggingFaceMultiModal.from_model_name(
|
| 124 |
+
"Qwen/Qwen2.5-VL-7B-Instruct",
|
| 125 |
+
temperature=0.7,
|
| 126 |
+
top_p=0.9,
|
| 127 |
+
top_k=40,
|
| 128 |
+
max_new_tokens=5120,
|
| 129 |
+
device_map="auto",
|
| 130 |
+
model_kwargs={"torch_dtype": "auto"}
|
| 131 |
+
)
|
| 132 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
# Code LLM
|
| 135 |
code_llm = HuggingFaceLLM(
|