Skip to content

fix: owned_by field in GET /v1/models returns list instead of string#46006

Open
nileshpatil6 wants to merge 1 commit into
huggingface:mainfrom
nileshpatil6:fix/model-manager-owned-by-list
Open

fix: owned_by field in GET /v1/models returns list instead of string#46006
nileshpatil6 wants to merge 1 commit into
huggingface:mainfrom
nileshpatil6:fix/model-manager-owned-by-list

Conversation

@nileshpatil6
Copy link
Copy Markdown

What does this fix?

In ModelManager.get_gen_models(), the owned_by field in the model list response was incorrectly set to a list instead of a string.

# Before (bug): returns a list like ["mistralai", "Mistral-7B-v0.1"]
author = repo.repo_id.split("/") if "/" in repo.repo_id else ""

# After (fix): returns just the author string "mistralai"
author = repo.repo_id.split("/")[0] if "/" in repo.repo_id else ""

str.split("/") returns a list of all segments. Without [0], the owned_by field in the GET /v1/models response contained a Python list (e.g. ["mistralai", "Mistral-7B-v0.1"]) instead of the expected author string ("mistralai"). This breaks OpenAI-compatible clients that parse the models list and expect owned_by to be a string.

Changes

  • src/transformers/cli/serving/model_manager.py: add [0] index to split("/") call so only the author segment is used for owned_by.

repo.repo_id.split("/") returns a list like ["author", "model_name"]
but owned_by expects a string. Add [0] index to extract just the author.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant