This repository was archived by the owner on Jul 4, 2025. It is now read-only.
chore: return model size after pulled #1626
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
model.yamlAPI Response bodyAPI Playground

Changes made
The provided git diff introduces changes primarily focused on tracking and handling a new attribute called
sizewithin theModelConfigstruct. Here are the key changes summarized:ModelConfig Struct Update:
uint64_t sizeis added to theModelConfigstruct to store the size of the model.FromJsonmethod is updated to parse thesizeattribute from JSON if present.ToJsonmethod is updated to include thesizeattribute in the JSON output.Printmethod now prints thesizeattribute along with other attributes.YamlHandler Update:
UpdateModelConfig, the YAML node is updated to include thesizeof the model if it is not NaN.sizeof typeuint64_ttodoublefor NaN check is unusual sinceuint64_tcan't be NaN.ParseGguf Function Update:
ParseGgufis updated to include an optionalstd::uint64_t sizeparameter.sizeis set onmodel_configwith a default of 0 if nosizeis provided.Model Service Update:
HandleDownloadUrlAsyncandHandleUrl), after a download task is finished, the total downloaded size (model_size) is calculated by summing upbytesfrom all items infinishedTask.items.ParseGgufis called with the computedmodel_sizeto ensure the size is recorded in theModelConfig.These changes enhance the system to manage and persist the size of model files across configurations and YAML updates.