Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: curl return early if model isn't local, with better message #1076

Open
jamesbraza opened this issue Sep 18, 2023 · 1 comment
Open
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs Tickets that no-one is currently working on ux

Comments

@jamesbraza
Copy link
Contributor

jamesbraza commented Sep 18, 2023

LocalAI version:

https://github.com/go-skynet/LocalAI/tree/30f120ee6a7979aa4ffbd94ccdc1e58b94155a44

Environment, CPU architecture, OS, and Version:

Darwin N7L493PWK4 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64

Describe the bug

When placing a model name that doesn't exist, two issues happen:

  1. The curl takes over 1 minute
  2. It prints all backends returned error: 23 errors occurred

To Reproduce

I am using a model name foo.bin (chosen because it doesn't match any downloaded):

> curl http://localhost:8080/models
{"object":"list","data":[{"id":"thebloke__wizardlm-13b-v1-0-uncensored-superhot-8k-ggml__wizardlm-13b-v1.0-superhot-8k.ggmlv3.q4_k_m.bin","object":"model"}]}
> curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d '{
     "model": "foo.bin",
     "prompt": "A long time ago in a galaxy far, far away",
     "temperature": 0.7
   }'
{"error":{"code":500,"message":"could not load model - all backends returned error: 23 errors occurred:\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unknown desc = failed loading model\n\t* could not load model: rpc error: code = Unavailable desc = error reading from server: EOF\n\t* could not load model: rpc error: code = Unknown desc = stat /models/foo.bin: no such file or directory\n\t* could not load model: rpc error: code = Unknown desc = stat /models/foo.bin: no such file or directory\n\t* could not load model: rpc error: code = Unknown desc = unsupported model type /models/foo.bin (should end with .onnx)\n\t* backend unsupported: /build/extra/grpc/huggingface/huggingface.py\n\t* backend unsupported: /build/extra/grpc/autogptq/autogptq.py\n\t* backend unsupported: /build/extra/grpc/bark/ttsbark.py\n\t* backend unsupported: /build/extra/grpc/diffusers/backend_diffusers.py\n\t* backend unsupported: /build/extra/grpc/exllama/exllama.py\n\n","type":""}}

Formatting that message:

could not load model - all backends returned error: 23 errors occurred:
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unknown desc = failed loading model
* could not load model: rpc error: code = Unavailable desc = error reading from server: EOF
* could not load model: rpc error: code = Unknown desc = stat /models/foo.bin: no such file or directory
* could not load model: rpc error: code = Unknown desc = stat /models/foo.bin: no such file or directory
* could not load model: rpc error: code = Unknown desc = unsupported model type /models/foo.bin (should end with .onnx)
* backend unsupported: /build/extra/grpc/huggingface/huggingface.py
* backend unsupported: /build/extra/grpc/autogptq/autogptq.py
* backend unsupported: /build/extra/grpc/bark/ttsbark.py
* backend unsupported: /build/extra/grpc/diffusers/backend_diffusers.py
* backend unsupported: /build/extra/grpc/exllama/exllama.py

Expected behavior

A desirable behavior is:

  1. curl returns quickly (<1 sec) when non-installed model
  2. Response has a better error message, saying the model doesn't match any locally installed model

In other words, the current behavior is a massive error message, and takes forever to actually show up. Ideally if a model isn't installed, a response comes immediately with a concise error message

@mudler
Copy link
Owner

mudler commented Nov 25, 2023

we should definetly enhance logging but also the logic here around loading.

Going to treat this as a feature request. We should at least not try at all the model if the file doesn't actually exist.

@mudler mudler added good first issue Good for newcomers up for grabs Tickets that no-one is currently working on labels Nov 25, 2023
@mudler mudler removed their assignment Nov 25, 2023
@mudler mudler added the ux label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers up for grabs Tickets that no-one is currently working on ux
Projects
None yet
Development

No branches or pull requests

3 participants