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

feat: multiple models #14

Merged
merged 1 commit into from
May 13, 2024
Merged

feat: multiple models #14

merged 1 commit into from
May 13, 2024

Conversation

vansangpfiev
Copy link
Contributor

@vansangpfiev vansangpfiev commented May 4, 2024

Issue link: https://github.com/janhq/cortex/issues/467

  • use std::unordered_map to store all llama_server_context (lsc)
  • refactor: move background thread to lsc, each lsc has its own background thread

We use mode_id as a key to find the model, so they have to be unique. That requires some changes in request parameter:
For completions:
Have to set value the model_alias for inferences/llamaCPP/loadmodel and inferences/llamaCPP/unloadmodel , this has to be the same as model parameter in inferences/llamaCPP/chat_completion
loadmodel/unloadmodel:

{
...
 "llama_model_path": "file_to_location"
  "model_alias": "model1"
...
}

chat_completion:

{
...
  "model": "model1"  
...
}

For embeddings:
The same for loadmodel/unloadmodel, for embedding request, we need to add model parameter
loadmodel/unloadmodel

{
...
    "llama_model_path": "e:/workspace/model/nomic-embed-text-v1.5.f16.gguf",
    "model_alias": "model1",
    "model_type": "embedding"
...
}

embedding

{
...  
  "input": "how are you",
  "model": "model1"
...
}

@vansangpfiev vansangpfiev marked this pull request as ready for review May 7, 2024 08:43
@vansangpfiev vansangpfiev self-assigned this May 7, 2024
@vansangpfiev vansangpfiev requested a review from tikikun May 7, 2024 08:56
Copy link

@tikikun tikikun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!!

@vansangpfiev vansangpfiev merged commit 4ad76ba into main May 13, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants