mirror of
https://github.com/fauxpilot/fauxpilot.git
synced 2025-07-12 16:13:36 -07:00
Some minor ergonomic changes for python backend
- Add validation rule to ensure is set to fastertransformer or python-backend - Add warning if model is unavailable, likely the user has not set correctly Signed-off-by: Parth Thakkar <thakkarparth007@gmail.com>
This commit is contained in:
parent
8df5058c5c
commit
4bf40cdb6c
3 changed files with 14 additions and 7 deletions
|
@ -97,7 +97,7 @@ class CodeGenProxy:
|
|||
output_len = np.ones_like(input_len).astype(np_type) * max_tokens
|
||||
num_logprobs = data.get('logprobs', -1)
|
||||
if num_logprobs is None:
|
||||
num_logprobs = 1
|
||||
num_logprobs = -1
|
||||
want_logprobs = num_logprobs > 0
|
||||
|
||||
temperature = data.get('temperature', 0.2)
|
||||
|
@ -246,8 +246,15 @@ class CodeGenProxy:
|
|||
st = time.time()
|
||||
try:
|
||||
completion, choices = self.generate(data)
|
||||
except InferenceServerException as E:
|
||||
print(E)
|
||||
except InferenceServerException as exc:
|
||||
# status: unavailable -- this happens if the `model` string is invalid
|
||||
print(exc)
|
||||
if exc.status() == 'StatusCode.UNAVAILABLE':
|
||||
print(
|
||||
f"WARNING: Model '{data['model']}' is not available. Please ensure that "
|
||||
"`model` is set to either 'fastertransformer' or 'py-model' depending on "
|
||||
"your installation"
|
||||
)
|
||||
completion = {}
|
||||
choices = []
|
||||
ed = time.time()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue