mirror of
https://github.com/fauxpilot/fauxpilot.git
synced 2025-07-16 10:03:25 -07:00
Error handling
This commit is contained in:
parent
6671196ec8
commit
6f49915d2a
3 changed files with 9 additions and 4 deletions
|
@ -10,4 +10,4 @@ COPY copilot_proxy .
|
|||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD [ "uvicorn", "--host", "0.0.0.0", "--port", "5000", "app:app"]
|
||||
CMD ["uvicorn", "--host", "0.0.0.0", "--port", "5000", "app:app"]
|
||||
|
|
|
@ -4,7 +4,7 @@ from pydantic import BaseModel
|
|||
|
||||
|
||||
class OpenAIinput(BaseModel):
|
||||
model: str
|
||||
model: str = "fastertransformer"
|
||||
prompt: Optional[str]
|
||||
suffix: Optional[str]
|
||||
max_tokens: Optional[int] = 16
|
||||
|
|
|
@ -6,7 +6,7 @@ import time
|
|||
import numpy as np
|
||||
import tritonclient.grpc as client_util
|
||||
from tokenizers import Tokenizer
|
||||
from tritonclient.utils import np_to_triton_dtype
|
||||
from tritonclient.utils import np_to_triton_dtype, InferenceServerException
|
||||
|
||||
np.finfo(np.dtype("float32"))
|
||||
np.finfo(np.dtype("float64"))
|
||||
|
@ -230,7 +230,12 @@ class CodeGenProxy:
|
|||
|
||||
def __call__(self, data: dict):
|
||||
st = time.time()
|
||||
try:
|
||||
completion, choices = self.generate(data)
|
||||
except InferenceServerException as E:
|
||||
print(E)
|
||||
completion = {}
|
||||
choices = []
|
||||
ed = time.time()
|
||||
print(f"Returned completion in {(ed - st) * 1000} ms")
|
||||
if data.get('stream', False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue