Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
·
a6b827b
1
Parent(s):
d23375c
fix: add websocket in handlerToken
Browse files- Dockerfile +2 -2
- main.py +2 -5
Dockerfile
CHANGED
@@ -5,9 +5,9 @@ FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
|
5 |
|
6 |
RUN apt-get update && apt-get upgrade -y \
|
7 |
&& apt-get install -y git build-essential libpq-dev gcc \
|
8 |
-
|
9 |
libclblast-dev libopenblas-dev software-properties-common \
|
10 |
-
g++-11 make python3 python-is-python3 pip
|
11 |
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
|
12 |
|
13 |
COPY . .
|
|
|
5 |
|
6 |
RUN apt-get update && apt-get upgrade -y \
|
7 |
&& apt-get install -y git build-essential libpq-dev gcc \
|
8 |
+
wget ocl-icd-opencl-dev opencl-headers clinfo \
|
9 |
libclblast-dev libopenblas-dev software-properties-common \
|
10 |
+
g++-11 make python3 python-is-python3 pip redis \
|
11 |
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
|
12 |
|
13 |
COPY . .
|
main.py
CHANGED
@@ -58,22 +58,19 @@ RETRIEVER = DB.as_retriever()
|
|
58 |
class MyCustomSyncHandler(BaseCallbackHandler):
|
59 |
def __init__(self):
|
60 |
self.end = False
|
61 |
-
self.callback = None
|
62 |
|
63 |
def on_llm_start(
|
64 |
self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any
|
65 |
) -> None:
|
66 |
self.end = False
|
67 |
-
self.callback = None
|
68 |
|
69 |
def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:
|
70 |
self.end = True
|
71 |
|
72 |
def on_llm_new_token(self, token: str, **kwargs) -> Any:
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
print(token)
|
77 |
|
78 |
# Create State
|
79 |
handlerToken = MyCustomSyncHandler()
|
|
|
58 |
class MyCustomSyncHandler(BaseCallbackHandler):
|
59 |
def __init__(self):
|
60 |
self.end = False
|
|
|
61 |
|
62 |
def on_llm_start(
|
63 |
self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any
|
64 |
) -> None:
|
65 |
self.end = False
|
|
|
66 |
|
67 |
def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:
|
68 |
self.end = True
|
69 |
|
70 |
def on_llm_new_token(self, token: str, **kwargs) -> Any:
|
71 |
+
print(self)
|
72 |
+
print(kwargs)
|
73 |
|
|
|
74 |
|
75 |
# Create State
|
76 |
handlerToken = MyCustomSyncHandler()
|