[PR #15766] server: populate parameter_size in /api/tags for safetensors models #46498

Open
opened 2026-04-25 01:55:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15766
Author: @nandanadileep
Created: 4/23/2026
Status: 🔄 Open

Base: mainHead: fix/parameter-size-safetensors-list


📝 Commits (1)

  • b9c487c server: populate parameter_size in /api/tags for safetensors models

📊 Changes

2 files changed (+81 additions, -7 deletions)

View changed files

📝 server/routes.go (+27 -7)
📝 server/routes_list_test.go (+54 -0)

📄 Description

Summary

Fixes #15679

ListHandler only used the manifest config fields (ModelType / FileType) for ParameterSize / QuantizationLevel, which are not written for local safetensors models at creation time. This caused /api/tags to return an empty parameter_size (and mismatched quantization_level) for models like gemma4:26b-mxfp8 and gemma4:26b-nvfp4.

/api/show already worked correctly by calling xserver.GetSafetensorsLLMInfo / xserver.GetSafetensorsDtype. This PR mirrors that same enrichment step in ListHandler so both endpoints stay consistent.

Changes

server/routes.goListHandler:

  • Build modelDetails before appending to the response slice.
  • When cf.ModelFormat == "safetensors" and the model has the "completion" capability, call xserver.GetSafetensorsLLMInfo(n) to populate Family and ParameterSize from the model's config.json.
  • Fall back to xserver.GetSafetensorsDtype(n) for QuantizationLevel when it isn't already set in the manifest config (matches the existing fall-back in ShowHandler for older manifests).

server/routes_list_test.goTestListSafetensorsDetails:

  • Creates a safetensors manifest with ModelType, FileType, and Capabilities set.
  • Asserts that ListHandler returns a non-empty ParameterSize and the correct QuantizationLevel.

Verification

  • go vet ./server/ — clean
  • go test ./server/ — all pass (4.4s)

Made with Cursor


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15766 **Author:** [@nandanadileep](https://github.com/nandanadileep) **Created:** 4/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/parameter-size-safetensors-list` --- ### 📝 Commits (1) - [`b9c487c`](https://github.com/ollama/ollama/commit/b9c487c74df9f373e1429c4bb078bd29c2c47bff) server: populate parameter_size in /api/tags for safetensors models ### 📊 Changes **2 files changed** (+81 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `server/routes.go` (+27 -7) 📝 `server/routes_list_test.go` (+54 -0) </details> ### 📄 Description ## Summary Fixes #15679 `ListHandler` only used the manifest config fields (`ModelType` / `FileType`) for `ParameterSize` / `QuantizationLevel`, which are **not** written for local safetensors models at creation time. This caused `/api/tags` to return an empty `parameter_size` (and mismatched `quantization_level`) for models like `gemma4:26b-mxfp8` and `gemma4:26b-nvfp4`. `/api/show` already worked correctly by calling `xserver.GetSafetensorsLLMInfo` / `xserver.GetSafetensorsDtype`. This PR mirrors that same enrichment step in `ListHandler` so both endpoints stay consistent. ## Changes **`server/routes.go`** — `ListHandler`: - Build `modelDetails` before appending to the response slice. - When `cf.ModelFormat == "safetensors"` and the model has the `"completion"` capability, call `xserver.GetSafetensorsLLMInfo(n)` to populate `Family` and `ParameterSize` from the model's `config.json`. - Fall back to `xserver.GetSafetensorsDtype(n)` for `QuantizationLevel` when it isn't already set in the manifest config (matches the existing fall-back in `ShowHandler` for older manifests). **`server/routes_list_test.go`** — `TestListSafetensorsDetails`: - Creates a safetensors manifest with `ModelType`, `FileType`, and `Capabilities` set. - Asserts that `ListHandler` returns a non-empty `ParameterSize` and the correct `QuantizationLevel`. ## Verification - `go vet ./server/` — clean - `go test ./server/` — all pass (4.4s) Made with [Cursor](https://cursor.com) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 01:55:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46498