Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
·
2453cc0
1
Parent(s):
08f602b
fix: add types
Browse files- load_models.py +0 -1
- main.py +1 -2
load_models.py
CHANGED
@@ -14,7 +14,6 @@ from transformers import (
|
|
14 |
LlamaTokenizer,
|
15 |
GenerationConfig,
|
16 |
pipeline,
|
17 |
-
TextStreamer
|
18 |
)
|
19 |
|
20 |
|
|
|
14 |
LlamaTokenizer,
|
15 |
GenerationConfig,
|
16 |
pipeline,
|
|
|
17 |
)
|
18 |
|
19 |
|
main.py
CHANGED
@@ -31,7 +31,6 @@ class Predict(BaseModel):
|
|
31 |
class Delete(BaseModel):
|
32 |
filename: str
|
33 |
|
34 |
-
|
35 |
class MyCustomAsyncHandler(AsyncCallbackHandler):
|
36 |
def on_llm_new_token(self, token: str, **kwargs) -> None:
|
37 |
print(f" token: {token}")
|
@@ -66,7 +65,7 @@ DB = Chroma(
|
|
66 |
|
67 |
RETRIEVER = DB.as_retriever()
|
68 |
|
69 |
-
LLM = load_model(device_type=DEVICE_TYPE, model_id=MODEL_ID, model_basename=MODEL_BASENAME, stream=True, callbacks
|
70 |
|
71 |
template = """you are a helpful, respectful and honest assistant. When answering questions, you should only use the documents provided.
|
72 |
You should only answer the topics that appear in these documents.
|
|
|
31 |
class Delete(BaseModel):
|
32 |
filename: str
|
33 |
|
|
|
34 |
class MyCustomAsyncHandler(AsyncCallbackHandler):
|
35 |
def on_llm_new_token(self, token: str, **kwargs) -> None:
|
36 |
print(f" token: {token}")
|
|
|
65 |
|
66 |
RETRIEVER = DB.as_retriever()
|
67 |
|
68 |
+
LLM = load_model(device_type=DEVICE_TYPE, model_id=MODEL_ID, model_basename=MODEL_BASENAME, stream=True, callbacks=[MyCustomAsyncHandler()])
|
69 |
|
70 |
template = """you are a helpful, respectful and honest assistant. When answering questions, you should only use the documents provided.
|
71 |
You should only answer the topics that appear in these documents.
|