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.yaml
API Response body
API Playground
Changes made
The provided git diff introduces changes primarily focused on tracking and handling a new attribute called
size
within theModelConfig
struct. Here are the key changes summarized:ModelConfig Struct Update:
uint64_t size
is added to theModelConfig
struct to store the size of the model.FromJson
method is updated to parse thesize
attribute from JSON if present.ToJson
method is updated to include thesize
attribute in the JSON output.Print
method now prints thesize
attribute along with other attributes.YamlHandler Update:
UpdateModelConfig
, the YAML node is updated to include thesize
of the model if it is not NaN.size
of typeuint64_t
todouble
for NaN check is unusual sinceuint64_t
can't be NaN.ParseGguf Function Update:
ParseGguf
is updated to include an optionalstd::uint64_t size
parameter.size
is set onmodel_config
with a default of 0 if nosize
is provided.Model Service Update:
HandleDownloadUrlAsync
andHandleUrl
), after a download task is finished, the total downloaded size (model_size
) is calculated by summing upbytes
from all items infinishedTask.items
.ParseGguf
is called with the computedmodel_size
to 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.