-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: #3476 - Mismatch id between model json and path #3645
fix: #3476 - Mismatch id between model json and path #3645
Conversation
Barecheck - Code coverage reportTotal: 57.49%Your code coverage diff: 0.18% ▴ Uncovered files and lines |
edb7417
to
c1f17c5
Compare
c1f17c5
to
acd522e
Compare
acd522e
to
8215091
Compare
@louis-jan Can I verify my understanding of this PR, and our overall strategy for handling legacy and future Model Folder:
In other words, will this have any impact on #3633? |
Hi @dan-homebrew, great concerns.
extensionManager
.get<ModelExtension>(ExtensionTypeEnum.Model)
?.getDownloadedModels() In other words, Model Extension, where it loads model DTOs from model folders. It is handled from LocalOAIExtension, so any local engines will be affected. In short, it's just a simple fix: Update the DTO, where the Model Extension previously delivered only the model.json content, now includes the original path. |
Got it - I'll focus my follow-up questions in this separate issue: |
Feature branch builds: https://github.com/janhq/jan/actions/runs/10871614291 |
@louis-jan Can I give a quick check before we approve it for 0.5.5: Bricking Risk + State Changes
Nitro vs. Cortex
|
Hi @dan-homebrew, Bricking Risk + State Changes
Nitro vs. Cortex
|
Thanks @louis-jan. Let's go ahead to merge, and use the v0.5.5 QA process to catch issues. |
Thanks @dan-homebrew. I will wait for the release cut before I merge this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be QA-ed rigorously before we release in 0.5.5
@dan-homebrew. You're right, I've tested and found an edge case with local model download, an older scenario that we should still account for - I'll take a closer look before the release. |
Describe Your Changes
This PR addresses issue #3476, where manually added models are broken due to a mismatched ID between the model.json file and the folder path, as the model_id in the JSON file does not match the folder name where the model is stored, causing issues with model recognition and functionality.
The first attempt in the past to address this is to make model_id the same as folder structure BUT that could lead to an issue where:
After thinking through, one of the better fixes is to work with ModelFile (a type alias of Model & File), where:
Deprecate Model Preserve Settings (will be replaced by Preset)
It's also removed the Preserve Model Settings, which isn't aligned well and might cause unexpected error (direct model.json overwrite)
https://discord.com/channels/1107178041848909847/1283644162838892564/1283749880937971774
Changes made (Generated)
Changes in
Advanced
componentpreserveModelSettingsAtom
import and related code.Changes in
ModelDownloadRow
componentisDownloaded
todownloadedModel
.requestCreateNewThread
function to usedownloadedModel
instead ofmodel
.Changes in
MyModelList
componentmodel
type toModelFile
.Removed features
restoreModelSettings
functionality has been removed.Refactoring
Removed deprecated code
isDownloaded
variable and replaced withdownloadedModel
.Other changes
Added test cases (Generated)
getDownloadedModels() with GGUF files:
getDownloadedModels()
returns downloaded models with correct file paths and model IDs.getDownloadedModels()
returns downloaded models when there are GGUF files in the model folder.getDownloadedModels()
returns downloaded models when there are multiple GGUF files in the model folder (for nested folders).getDownloadedModels() with uppercased GGUF files:
getDownloadedModels()
returns downloaded models with correct file paths and model IDs.getDownloadedModels()
returns downloaded models when there are uppercased GGUF files in the model folder.getDownloadedModels() with GGUF & TensorRT files:
getDownloadedModels()
returns downloaded models with correct file paths and model IDs.getDownloadedModels()
returns downloaded models when there are both GGUF and TensorRT files in the model folder.deleteModel() for GGUF models:
deleteModel()
deletes the GGUF file when the model is a GGUF model.deleteModel()
does not delete any files when the GGUF file is not present.deleteModel()
deletes the entire model folder when the model is an imported model.deleteModel()
deletes the TensorRT file when the model is a TensorRT model.(Implicit) Test case checks if
deleteModel()
callsfs.unlinkSync()
for GGUF files andfs.rm()
for TensorRT files and entire model folders for imported models.Fixes Issues
Self Checklist