updates llama_index to 0.10.15
Browse files- README.md +2 -0
- app.py +35 -33
- explainable.py +1 -1
- graph.html +2 -2
- kron/llm_predictor/KronLLMPredictor.py +4 -4
- kron/llm_predictor/KronLangChainLLM.py +3 -3
- kron/llm_predictor/KronOpenAILLM.py +16 -5
- kron/llm_predictor/openai_utils.py +7 -5
- kron/llm_predictor/utils.py +2 -2
- measurable.py +1 -1
- requirements.txt +6 -2
- storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/default__vector_store.json +3 -0
- storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/docstore.json +3 -0
- storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/graph_store.json +3 -0
- storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/index_store.json +3 -0
README.md
CHANGED
@@ -3,6 +3,7 @@ title: Mlk8s
|
|
3 |
emoji: 😻
|
4 |
colorFrom: pink
|
5 |
colorTo: pink
|
|
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.25.0
|
8 |
app_file: app.py
|
@@ -11,3 +12,4 @@ license: openrail
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
3 |
emoji: 😻
|
4 |
colorFrom: pink
|
5 |
colorTo: pink
|
6 |
+
python_version: 3.9
|
7 |
sdk: streamlit
|
8 |
sdk_version: 1.25.0
|
9 |
app_file: app.py
|
|
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
15 |
+
|
app.py
CHANGED
@@ -29,18 +29,19 @@ hf_api_key = os.environ['HF_TOKEN']
|
|
29 |
ch_api_key = os.environ['COHERE_TOKEN']
|
30 |
bs_api_key = os.environ['BASETEN_TOKEN']
|
31 |
|
32 |
-
index_model = "Writer/camel-5b-hf"
|
|
|
33 |
INDEX_NAME = f"{index_model.replace('/', '-')}-default-no-coref"
|
34 |
persist_path = f"storage/{INDEX_NAME}"
|
35 |
MAX_LENGTH = 1024
|
36 |
MAX_NEW_TOKENS = 250
|
37 |
|
38 |
-
import baseten
|
39 |
-
|
40 |
-
def set_baseten_key(bs_api_key):
|
41 |
-
baseten.login(bs_api_key)
|
42 |
|
43 |
-
set_baseten_key(bs_api_key)
|
44 |
|
45 |
def autoplay_video(video_path):
|
46 |
with open(video_path, "rb") as f:
|
@@ -70,16 +71,16 @@ f'''
|
|
70 |
st.caption('''###### corpus by [@[email protected]](https://sigmoid.social/@ArxivHealthcareNLP)''')
|
71 |
st.caption('''###### KG Questions by [arylwen](https://github.com/arylwen/mlk8s)''')
|
72 |
|
73 |
-
from llama_index import StorageContext
|
74 |
-
from llama_index import ServiceContext
|
75 |
-
from llama_index import load_index_from_storage
|
76 |
-
from llama_index.
|
77 |
-
from llama_index.node_parser import SimpleNodeParser
|
78 |
-
from llama_index import LLMPredictor
|
79 |
|
80 |
from langchain import HuggingFaceHub
|
81 |
from langchain.llms.cohere import Cohere
|
82 |
-
from langchain.llms import Baseten
|
83 |
|
84 |
import tiktoken
|
85 |
|
@@ -87,11 +88,11 @@ import openai
|
|
87 |
#extensions to llama_index to support openai compatible endpoints, e.g. llama-api
|
88 |
from kron.llm_predictor.KronOpenAILLM import KronOpenAI
|
89 |
#baseten deployment expects a specific request format
|
90 |
-
from kron.llm_predictor.KronBasetenCamelLLM import KronBasetenCamelLLM
|
91 |
from kron.llm_predictor.KronLLMPredictor import KronLLMPredictor
|
92 |
|
93 |
#writer/camel uses endoftext
|
94 |
-
from llama_index.utils import globals_helper
|
95 |
enc = tiktoken.get_encoding("gpt2")
|
96 |
tokenizer = lambda text: enc.encode(text, allowed_special={"<|endoftext|>"})
|
97 |
globals_helper._tokenizer = tokenizer
|
@@ -129,15 +130,15 @@ def get_cohere_predictor(query_model):
|
|
129 |
llm_predictor = LLMPredictor(llm)
|
130 |
return llm_predictor
|
131 |
|
132 |
-
def get_baseten_predictor(query_model):
|
133 |
-
# no embeddings for now
|
134 |
-
set_openai_local()
|
135 |
-
llm=KronBasetenCamelLLM(model='3yd1ke3', temperature = 0.01,
|
136 |
# model_kwargs={"temperature": 0.01, "max_length": MAX_LENGTH, 'repetition_penalty':1.07},
|
137 |
-
model_kwargs={"temperature": 0.01, "max_length": MAX_LENGTH, 'frequency_penalty':1},
|
138 |
-
cohere_api_key=ch_api_key)
|
139 |
-
llm_predictor = LLMPredictor(llm)
|
140 |
-
return llm_predictor
|
141 |
|
142 |
def get_kron_openai_predictor(query_model):
|
143 |
# define LLM
|
@@ -150,7 +151,8 @@ def get_servce_context(llm_predictor):
|
|
150 |
# define TextSplitter
|
151 |
text_splitter = SentenceSplitter(chunk_size=192, chunk_overlap=48, paragraph_separator='\n')
|
152 |
#define NodeParser
|
153 |
-
node_parser = SimpleNodeParser(text_splitter=text_splitter)
|
|
|
154 |
#define ServiceContext
|
155 |
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, node_parser=node_parser)
|
156 |
return service_context
|
@@ -219,11 +221,11 @@ def build_cohere_query_engine(query_model, persist_path):
|
|
219 |
query_engine = load_query_engine(llm_predictor, persist_path)
|
220 |
return query_engine
|
221 |
|
222 |
-
|
223 |
-
def build_baseten_query_engine(query_model, persist_path):
|
224 |
-
llm_predictor = get_baseten_predictor(query_model)
|
225 |
-
query_engine = load_query_engine(llm_predictor, persist_path)
|
226 |
-
return query_engine
|
227 |
|
228 |
def format_response(answer):
|
229 |
# Replace any eventual --
|
@@ -257,18 +259,18 @@ if __spaces__ :
|
|
257 |
with query:
|
258 |
answer_model = st.radio(
|
259 |
"Choose the model used for inference:",
|
260 |
-
('hf/tiiuae/falcon-7b-instruct', 'cohere/command', '
|
261 |
)
|
262 |
else :
|
263 |
with query:
|
264 |
answer_model = st.radio(
|
265 |
"Choose the model used for inference:",
|
266 |
-
('Writer/camel-5b-hf', 'mosaicml/mpt-7b-instruct', 'hf/tiiuae/falcon-7b-instruct', 'cohere/command', 'baseten/Camel-5b', 'openai/
|
267 |
)
|
268 |
|
269 |
-
if answer_model == 'openai/
|
270 |
print(answer_model)
|
271 |
-
query_model = '
|
272 |
clear_question(query_model)
|
273 |
set_openai()
|
274 |
query_engine = build_kron_query_engine(query_model, persist_path)
|
|
|
29 |
ch_api_key = os.environ['COHERE_TOKEN']
|
30 |
bs_api_key = os.environ['BASETEN_TOKEN']
|
31 |
|
32 |
+
#index_model = "Writer/camel-5b-hf"
|
33 |
+
index_model = "Arylwen/instruct-palmyra-20b-gptq-8"
|
34 |
INDEX_NAME = f"{index_model.replace('/', '-')}-default-no-coref"
|
35 |
persist_path = f"storage/{INDEX_NAME}"
|
36 |
MAX_LENGTH = 1024
|
37 |
MAX_NEW_TOKENS = 250
|
38 |
|
39 |
+
#import baseten
|
40 |
+
#@st.cache_resource
|
41 |
+
#def set_baseten_key(bs_api_key):
|
42 |
+
# baseten.login(bs_api_key)
|
43 |
|
44 |
+
#set_baseten_key(bs_api_key)
|
45 |
|
46 |
def autoplay_video(video_path):
|
47 |
with open(video_path, "rb") as f:
|
|
|
71 |
st.caption('''###### corpus by [@[email protected]](https://sigmoid.social/@ArxivHealthcareNLP)''')
|
72 |
st.caption('''###### KG Questions by [arylwen](https://github.com/arylwen/mlk8s)''')
|
73 |
|
74 |
+
from llama_index.core import StorageContext, ServiceContext, load_index_from_storage
|
75 |
+
#from llama_index import ServiceContext
|
76 |
+
# from llama_index import load_index_from_storage
|
77 |
+
from llama_index.core.node_parser import SentenceSplitter
|
78 |
+
#from llama_index.node_parser import SimpleNodeParser
|
79 |
+
from llama_index.core.service_context_elements.llm_predictor import LLMPredictor
|
80 |
|
81 |
from langchain import HuggingFaceHub
|
82 |
from langchain.llms.cohere import Cohere
|
83 |
+
#from langchain.llms import Baseten
|
84 |
|
85 |
import tiktoken
|
86 |
|
|
|
88 |
#extensions to llama_index to support openai compatible endpoints, e.g. llama-api
|
89 |
from kron.llm_predictor.KronOpenAILLM import KronOpenAI
|
90 |
#baseten deployment expects a specific request format
|
91 |
+
#from kron.llm_predictor.KronBasetenCamelLLM import KronBasetenCamelLLM
|
92 |
from kron.llm_predictor.KronLLMPredictor import KronLLMPredictor
|
93 |
|
94 |
#writer/camel uses endoftext
|
95 |
+
from llama_index.core.utils import globals_helper
|
96 |
enc = tiktoken.get_encoding("gpt2")
|
97 |
tokenizer = lambda text: enc.encode(text, allowed_special={"<|endoftext|>"})
|
98 |
globals_helper._tokenizer = tokenizer
|
|
|
130 |
llm_predictor = LLMPredictor(llm)
|
131 |
return llm_predictor
|
132 |
|
133 |
+
#def get_baseten_predictor(query_model):
|
134 |
+
# # no embeddings for now
|
135 |
+
# set_openai_local()
|
136 |
+
# llm=KronBasetenCamelLLM(model='3yd1ke3', temperature = 0.01,
|
137 |
# model_kwargs={"temperature": 0.01, "max_length": MAX_LENGTH, 'repetition_penalty':1.07},
|
138 |
+
# model_kwargs={"temperature": 0.01, "max_length": MAX_LENGTH, 'frequency_penalty':1},
|
139 |
+
# cohere_api_key=ch_api_key)
|
140 |
+
# llm_predictor = LLMPredictor(llm)
|
141 |
+
# return llm_predictor
|
142 |
|
143 |
def get_kron_openai_predictor(query_model):
|
144 |
# define LLM
|
|
|
151 |
# define TextSplitter
|
152 |
text_splitter = SentenceSplitter(chunk_size=192, chunk_overlap=48, paragraph_separator='\n')
|
153 |
#define NodeParser
|
154 |
+
#node_parser = SimpleNodeParser(text_splitter=text_splitter)
|
155 |
+
node_parser = text_splitter
|
156 |
#define ServiceContext
|
157 |
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, node_parser=node_parser)
|
158 |
return service_context
|
|
|
221 |
query_engine = load_query_engine(llm_predictor, persist_path)
|
222 |
return query_engine
|
223 |
|
224 |
+
#@st.cache_resource
|
225 |
+
#def build_baseten_query_engine(query_model, persist_path):
|
226 |
+
# llm_predictor = get_baseten_predictor(query_model)
|
227 |
+
# query_engine = load_query_engine(llm_predictor, persist_path)
|
228 |
+
# return query_engine
|
229 |
|
230 |
def format_response(answer):
|
231 |
# Replace any eventual --
|
|
|
259 |
with query:
|
260 |
answer_model = st.radio(
|
261 |
"Choose the model used for inference:",
|
262 |
+
('hf/tiiuae/falcon-7b-instruct', 'cohere/command', 'openai/gpt-3.5-turbo-instruct') #TODO start hf inference container on demand
|
263 |
)
|
264 |
else :
|
265 |
with query:
|
266 |
answer_model = st.radio(
|
267 |
"Choose the model used for inference:",
|
268 |
+
('Writer/camel-5b-hf', 'mosaicml/mpt-7b-instruct', 'hf/tiiuae/falcon-7b-instruct', 'cohere/command', 'baseten/Camel-5b', 'openai/gpt-3.5-turbo-instruct')
|
269 |
)
|
270 |
|
271 |
+
if answer_model == 'openai/gpt-3.5-turbo-instruct':
|
272 |
print(answer_model)
|
273 |
+
query_model = 'gpt-3.5-turbo-instruct'
|
274 |
clear_question(query_model)
|
275 |
set_openai()
|
276 |
query_engine = build_kron_query_engine(query_model, persist_path)
|
explainable.py
CHANGED
@@ -7,7 +7,7 @@ def explain(answer):
|
|
7 |
#all_reference_texts = ''
|
8 |
for nodewithscore in answer.source_nodes:
|
9 |
node = nodewithscore.node
|
10 |
-
from llama_index.schema import NodeRelationship
|
11 |
if NodeRelationship.SOURCE in node.relationships:
|
12 |
node_id = node.relationships[NodeRelationship.SOURCE].node_id
|
13 |
node_id = node_id.split('/')[-1]
|
|
|
7 |
#all_reference_texts = ''
|
8 |
for nodewithscore in answer.source_nodes:
|
9 |
node = nodewithscore.node
|
10 |
+
from llama_index.core.schema import NodeRelationship
|
11 |
if NodeRelationship.SOURCE in node.relationships:
|
12 |
node_id = node.relationships[NodeRelationship.SOURCE].node_id
|
13 |
node_id = node_id.split('/')[-1]
|
graph.html
CHANGED
@@ -88,8 +88,8 @@
|
|
88 |
|
89 |
|
90 |
// parsing and collecting nodes and edges from the python
|
91 |
-
nodes = new vis.DataSet([]);
|
92 |
-
edges = new vis.DataSet([]);
|
93 |
|
94 |
nodeColors = {};
|
95 |
allNodes = nodes.get({ returnType: "Object" });
|
|
|
88 |
|
89 |
|
90 |
// parsing and collecting nodes and edges from the python
|
91 |
+
nodes = new vis.DataSet([{"color": "#97c2fc", "id": "input-output pairs", "label": "input-output pairs", "shape": "dot", "title": "input-output pairs"}, {"color": "#97c2fc", "id": "input", "label": "input", "shape": "dot", "title": "input"}, {"color": "#97c2fc", "id": "is converted into", "label": "is converted into", "shape": "dot", "title": "is converted into"}, {"color": "#97c2fc", "id": "of", "label": "of", "shape": "dot", "title": "of"}, {"color": "#97c2fc", "id": "and", "label": "and", "shape": "dot", "title": "and"}, {"color": "#97c2fc", "id": "includes", "label": "includes", "shape": "dot", "title": "includes"}, {"color": "#97c2fc", "id": "examples", "label": "examples", "shape": "dot", "title": "examples"}, {"color": "#97c2fc", "id": "text-to-text-transfer-transformer", "label": "text-to-text-transfer-transformer", "shape": "dot", "title": "text-to-text-transfer-transformer"}, {"color": "#97c2fc", "id": "by", "label": "by", "shape": "dot", "title": "by"}, {"color": "#97c2fc", "id": "is strong baseline", "label": "is strong baseline", "shape": "dot", "title": "is strong baseline"}, {"color": "#97c2fc", "id": "combined with cross-encoder re-ranker", "label": "combined with cross-encoder re-ranker", "shape": "dot", "title": "combined with cross-encoder re-ranker"}, {"color": "#97c2fc", "id": "is", "label": "is", "shape": "dot", "title": "is"}, {"color": "#97c2fc", "id": "for", "label": "for", "shape": "dot", "title": "for"}, {"color": "#97c2fc", "id": "mimic-cxr", "label": "mimic-cxr", "shape": "dot", "title": "mimic-cxr"}, {"color": "#97c2fc", "id": "output", "label": "output", "shape": "dot", "title": "output"}, {"color": "#97c2fc", "id": "mimic", "label": "mimic", "shape": "dot", "title": "mimic"}, {"color": "#97c2fc", "id": "cxr", "label": "cxr", "shape": "dot", "title": "cxr"}, {"color": "#97c2fc", "id": "generate", "label": "generate", "shape": "dot", "title": "generate"}, {"color": "#97c2fc", "id": "consumer-oriented replies", "label": "consumer-oriented replies", "shape": "dot", "title": "consumer-oriented replies"}, {"color": "#97c2fc", "id": "pairs", "label": "pairs", "shape": "dot", "title": "pairs"}, {"color": "#97c2fc", "id": "de-identified", "label": "de-identified", "shape": "dot", "title": "de-identified"}, {"color": "#97c2fc", "id": "both", "label": "both", "shape": "dot", "title": "both"}]);
|
92 |
+
edges = new vis.DataSet([{"from": "input", "title": "input", "to": "is converted into"}, {"from": "input", "title": "probability", "to": "of"}, {"from": "input", "title": "input", "to": "and"}, {"from": "input", "title": "input", "to": "includes"}, {"from": "input", "title": "input", "to": "examples"}, {"from": "input", "title": "input", "to": "text-to-text-transfer-transformer"}, {"from": "input", "title": "input", "to": "by"}, {"from": "input", "title": "BM25", "to": "is strong baseline"}, {"from": "input", "title": "BM25", "to": "combined with cross-encoder re-ranker"}, {"from": "input", "title": "BM25", "to": "is"}, {"from": "input", "title": "input", "to": "for"}, {"from": "generate", "title": "generate", "to": "consumer-oriented replies"}, {"from": "pairs", "title": "pairs", "to": "de-identified"}, {"from": "pairs", "title": "summaries", "to": "both"}]);
|
93 |
|
94 |
nodeColors = {};
|
95 |
allNodes = nodes.get({ returnType: "Object" });
|
kron/llm_predictor/KronLLMPredictor.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
|
2 |
from typing import Any, Generator, Optional, Protocol, Tuple, runtime_checkable
|
3 |
|
4 |
-
from llama_index import LLMPredictor
|
5 |
-
from llama_index.llms.utils import LLMType
|
6 |
-
from llama_index.callbacks.base import CallbackManager
|
7 |
|
8 |
from kron.llm_predictor.utils import kron_resolve_llm
|
9 |
|
@@ -32,7 +32,7 @@ class KronLLMPredictor(LLMPredictor):
|
|
32 |
) -> None:
|
33 |
"""Initialize params."""
|
34 |
self._llm = kron_resolve_llm(llm)
|
35 |
-
self.callback_manager = callback_manager or CallbackManager([])
|
36 |
|
37 |
|
38 |
|
|
|
1 |
|
2 |
from typing import Any, Generator, Optional, Protocol, Tuple, runtime_checkable
|
3 |
|
4 |
+
from llama_index.core.service_context_elements.llm_predictor import LLMPredictor
|
5 |
+
from llama_index.core.llms.utils import LLMType
|
6 |
+
from llama_index.core.callbacks.base import CallbackManager
|
7 |
|
8 |
from kron.llm_predictor.utils import kron_resolve_llm
|
9 |
|
|
|
32 |
) -> None:
|
33 |
"""Initialize params."""
|
34 |
self._llm = kron_resolve_llm(llm)
|
35 |
+
self._llm.callback_manager = callback_manager or CallbackManager([])
|
36 |
|
37 |
|
38 |
|
kron/llm_predictor/KronLangChainLLM.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
from llama_index.bridge.langchain import BaseLanguageModel, BaseChatModel
|
2 |
from llama_index.llms.langchain import LangChainLLM
|
3 |
-
from llama_index.bridge.langchain import OpenAI, ChatOpenAI
|
4 |
|
5 |
-
from llama_index.llms
|
6 |
|
7 |
from kron.llm_predictor.openai_utils import kron_openai_modelname_to_contextsize
|
8 |
|
|
|
1 |
+
from llama_index.core.bridge.langchain import BaseLanguageModel, BaseChatModel
|
2 |
from llama_index.llms.langchain import LangChainLLM
|
3 |
+
from llama_index.core.bridge.langchain import OpenAI, ChatOpenAI
|
4 |
|
5 |
+
from llama_index.core.llms import LLMMetadata
|
6 |
|
7 |
from kron.llm_predictor.openai_utils import kron_openai_modelname_to_contextsize
|
8 |
|
kron/llm_predictor/KronOpenAILLM.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
from typing import Any, Awaitable, Callable, Dict, Optional, Sequence
|
2 |
|
3 |
-
from llama_index.bridge.langchain import BaseLanguageModel, BaseChatModel
|
4 |
-
from llama_index.llms.langchain import LangChainLLM
|
5 |
from llama_index.llms.openai import OpenAI
|
6 |
|
7 |
-
from llama_index.llms.
|
8 |
-
LLM,
|
9 |
ChatMessage,
|
10 |
ChatResponse,
|
11 |
ChatResponseAsyncGen,
|
@@ -16,6 +16,15 @@ from llama_index.llms.base import (
|
|
16 |
LLMMetadata,
|
17 |
)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
from kron.llm_predictor.openai_utils import kron_openai_modelname_to_contextsize
|
20 |
|
21 |
class KronOpenAI(OpenAI):
|
@@ -25,7 +34,9 @@ class KronOpenAI(OpenAI):
|
|
25 |
return LLMMetadata(
|
26 |
context_window=kron_openai_modelname_to_contextsize(self.model),
|
27 |
num_output=self.max_tokens or -1,
|
28 |
-
is_chat_model=self.
|
|
|
|
|
29 |
)
|
30 |
|
31 |
def complete(self, prompt: str, **kwargs: Any) -> CompletionResponse:
|
|
|
1 |
from typing import Any, Awaitable, Callable, Dict, Optional, Sequence
|
2 |
|
3 |
+
from llama_index.core.bridge.langchain import BaseLanguageModel, BaseChatModel
|
4 |
+
#from llama_index.core.llms.langchain import LangChainLLM
|
5 |
from llama_index.llms.openai import OpenAI
|
6 |
|
7 |
+
from llama_index.core.base.llms.types import (
|
8 |
+
#LLM,
|
9 |
ChatMessage,
|
10 |
ChatResponse,
|
11 |
ChatResponseAsyncGen,
|
|
|
16 |
LLMMetadata,
|
17 |
)
|
18 |
|
19 |
+
from llama_index.llms.openai.utils import (
|
20 |
+
from_openai_message,
|
21 |
+
is_chat_model,
|
22 |
+
is_function_calling_model,
|
23 |
+
openai_modelname_to_contextsize,
|
24 |
+
resolve_openai_credentials,
|
25 |
+
to_openai_message_dicts,
|
26 |
+
)
|
27 |
+
|
28 |
from kron.llm_predictor.openai_utils import kron_openai_modelname_to_contextsize
|
29 |
|
30 |
class KronOpenAI(OpenAI):
|
|
|
34 |
return LLMMetadata(
|
35 |
context_window=kron_openai_modelname_to_contextsize(self.model),
|
36 |
num_output=self.max_tokens or -1,
|
37 |
+
is_chat_model=is_chat_model(model=self._get_model_name()),
|
38 |
+
is_function_calling_model=is_function_calling_model(model=self._get_model_name()),
|
39 |
+
model_name=self.model,
|
40 |
)
|
41 |
|
42 |
def complete(self, prompt: str, **kwargs: Any) -> CompletionResponse:
|
kron/llm_predictor/openai_utils.py
CHANGED
@@ -37,12 +37,14 @@ TURBO_MODELS = {
|
|
37 |
"gpt-3.5-turbo-16k-0613": 16384,
|
38 |
# 0301 models
|
39 |
"gpt-3.5-turbo-0301": 4096,
|
|
|
|
|
40 |
}
|
41 |
|
42 |
-
GPT3_5_MODELS = {
|
43 |
-
"text-davinci-003": 4097,
|
44 |
-
"text-davinci-002": 4097,
|
45 |
-
}
|
46 |
|
47 |
GPT3_MODELS = {
|
48 |
"text-ada-001": 2049,
|
@@ -57,7 +59,7 @@ GPT3_MODELS = {
|
|
57 |
ALL_AVAILABLE_MODELS = {
|
58 |
**GPT4_MODELS,
|
59 |
**TURBO_MODELS,
|
60 |
-
**GPT3_5_MODELS,
|
61 |
**GPT3_MODELS,
|
62 |
**LOCAL_MODELS,
|
63 |
}
|
|
|
37 |
"gpt-3.5-turbo-16k-0613": 16384,
|
38 |
# 0301 models
|
39 |
"gpt-3.5-turbo-0301": 4096,
|
40 |
+
# turbo models
|
41 |
+
"gpt-3.5-turbo-instruct": 4096
|
42 |
}
|
43 |
|
44 |
+
#GPT3_5_MODELS = {
|
45 |
+
# "text-davinci-003": 4097,
|
46 |
+
# "text-davinci-002": 4097,
|
47 |
+
#}
|
48 |
|
49 |
GPT3_MODELS = {
|
50 |
"text-ada-001": 2049,
|
|
|
59 |
ALL_AVAILABLE_MODELS = {
|
60 |
**GPT4_MODELS,
|
61 |
**TURBO_MODELS,
|
62 |
+
# **GPT3_5_MODELS,
|
63 |
**GPT3_MODELS,
|
64 |
**LOCAL_MODELS,
|
65 |
}
|
kron/llm_predictor/utils.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
from typing import Optional, Union
|
2 |
-
from llama_index.llms.
|
3 |
from langchain.base_language import BaseLanguageModel
|
4 |
|
5 |
from kron.llm_predictor.KronLangChainLLM import KronLangChainLLM
|
6 |
from llama_index.llms.openai import OpenAI
|
7 |
|
8 |
-
from llama_index.llms.utils import LLMType
|
9 |
|
10 |
|
11 |
def kron_resolve_llm(llm: Optional[LLMType] = None) -> LLM:
|
|
|
1 |
from typing import Optional, Union
|
2 |
+
from llama_index.core.llms.llm import LLM
|
3 |
from langchain.base_language import BaseLanguageModel
|
4 |
|
5 |
from kron.llm_predictor.KronLangChainLLM import KronLangChainLLM
|
6 |
from llama_index.llms.openai import OpenAI
|
7 |
|
8 |
+
from llama_index.core.llms.utils import LLMType
|
9 |
|
10 |
|
11 |
def kron_resolve_llm(llm: Optional[LLMType] = None) -> LLM:
|
measurable.py
CHANGED
@@ -18,7 +18,7 @@ def display_wordcloud(answer, answer_str):
|
|
18 |
all_reference_texts = ''
|
19 |
for nodewithscore in answer.source_nodes:
|
20 |
node = nodewithscore.node
|
21 |
-
from llama_index.schema import NodeRelationship
|
22 |
#if NodeRelationship.SOURCE in node.relationships:
|
23 |
all_reference_texts = all_reference_texts + '\n' + node.text
|
24 |
wordcloud_r = wordcloud.generate(all_reference_texts)
|
|
|
18 |
all_reference_texts = ''
|
19 |
for nodewithscore in answer.source_nodes:
|
20 |
node = nodewithscore.node
|
21 |
+
from llama_index.core.schema import NodeRelationship
|
22 |
#if NodeRelationship.SOURCE in node.relationships:
|
23 |
all_reference_texts = all_reference_texts + '\n' + node.text
|
24 |
wordcloud_r = wordcloud.generate(all_reference_texts)
|
requirements.txt
CHANGED
@@ -7,13 +7,15 @@
|
|
7 |
#streamlit run appname.py
|
8 |
|
9 |
torch
|
10 |
-
transformers
|
11 |
llama_index
|
|
|
|
|
12 |
pyvis
|
13 |
nltk
|
14 |
python-dotenv
|
15 |
cohere
|
16 |
-
baseten
|
17 |
st-star-rating
|
18 |
wordcloud
|
19 |
gensim
|
@@ -21,3 +23,5 @@ amazon-dax-client>=1.1.7
|
|
21 |
boto3>=1.26.79
|
22 |
pytest>=7.2.1
|
23 |
requests>=2.28.2
|
|
|
|
|
|
7 |
#streamlit run appname.py
|
8 |
|
9 |
torch
|
10 |
+
transformers>=4.34
|
11 |
llama_index
|
12 |
+
llama-index-llms-langchain
|
13 |
+
langchain
|
14 |
pyvis
|
15 |
nltk
|
16 |
python-dotenv
|
17 |
cohere
|
18 |
+
#baseten
|
19 |
st-star-rating
|
20 |
wordcloud
|
21 |
gensim
|
|
|
23 |
boto3>=1.26.79
|
24 |
pytest>=7.2.1
|
25 |
requests>=2.28.2
|
26 |
+
packaging>20.0
|
27 |
+
langchain-core>=0.1
|
storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/default__vector_store.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d17ed74c1649a438e518a8dc56a7772913dfe1ea7a7605bce069c63872431455
|
3 |
+
size 72
|
storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/docstore.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:362322a55d70bbd5957c4a46426ba99b249b776b1ddeb41f1744bc389892a2be
|
3 |
+
size 38549003
|
storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/graph_store.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:36417c5a46c4748fd020428edcedfd267f5298e752d3bef5ce750c3fc301d209
|
3 |
+
size 2419238
|
storage/Arylwen-instruct-palmyra-20b-gptq-8-default-no-coref/index_store.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ce19d43152283102b16ec8d7f1eb0216482f6134f6acba8ab098ef3fd2e45071
|
3 |
+
size 4573376
|