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: track internally started models by ID #3693

Merged
merged 13 commits into from
Oct 2, 2024
Merged

Conversation

mudler
Copy link
Owner

@mudler mudler commented Sep 30, 2024

Description

This PR changes how we track models that are being loaded. Instead of refering to the model's file and path, we are going to track now the model ID. The model ID is also the name of each model that can be specified with a name - in this way we keep a 1:1 mapping and we fallback into using the model file name if a model name is not provided.

This allows for instance now to have the same backing model to be loaded with different parameters, and helps also into understanding which models are loaded as it now references what is returned when we list available models or models loaded in /system.

This pull request includes significant changes to the model loading and backend configuration processes in the codebase. The changes primarily focus on improving the flexibility and robustness of model handling by introducing a new modelID parameter and refactoring related functions.

Copilot summary

Model Loading Enhancements:

  • Introduced modelID parameter in the Options struct and related functions to uniquely identify models. (pkg/model/options.go) [1] [2]
  • Updated the LoadModel function to use modelID for loading and checking models. (pkg/model/loader.go) [1] [2] [3]

Backend Configuration Improvements:

  • Refactored modelOpts to include default options and handle modelID. (core/backend/options.go)
  • Modified various backend-related functions to remove redundant options and use the new modelID parameter. (core/backend/embeddings.go, core/backend/image.go, core/backend/llm.go) [1] [2] [3] [4]

GRPC Model Loading Adjustments:

  • Updated the grpcModel function to accommodate the modelID parameter and ensure proper logging and error handling. (pkg/model/initializers.go) [1] [2] [3] [4] [5] [6] [7] [8]

Testing Updates:

  • Adjusted unit tests to align with the new modelID parameter and updated test cases accordingly. (pkg/model/loader_test.go)
  • Enhanced end-to-end tests to improve error handling and response validation. (tests/e2e-aio/e2e_test.go)

Copy link

netlify bot commented Sep 30, 2024

Deploy Preview for localai ready!

Name Link
🔨 Latest commit c93a669
🔍 Latest deploy log https://app.netlify.com/sites/localai/deploys/66fcce733b232b00082cf4e8
😎 Deploy Preview https://deploy-preview-3693--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mudler mudler added the enhancement New feature or request label Sep 30, 2024
@siddimore
Copy link
Contributor

nice change @mudler

tests/e2e-aio/e2e_test.go Outdated Show resolved Hide resolved
@mudler mudler force-pushed the chore/refactor_modelID branch 2 times, most recently from f77f5fa to ae1a7c7 Compare October 1, 2024 10:34
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
Signed-off-by: Ettore Di Giacinto <[email protected]>
@mudler mudler merged commit 0965c6c into master Oct 2, 2024
31 checks passed
@mudler mudler deleted the chore/refactor_modelID branch October 2, 2024 06:56
@mudler mudler mentioned this pull request Oct 2, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants