Skip to content

[Request] Enable the retrieval of more detailed repository data using huggingface_hub.hf_api #2748

@suzukimain

Description

@suzukimain

Is your feature request related to a problem? Please describe.
There is no option in huggingface_hub.hf_api to get the type of files in the repository or to get the base model of the checkpoint files.

Describe the solution you'd like
Please make it possible to retrieve using hf_api

Describe alternatives you've considered
baseModels should be in hf_api.model_info, but it is currently not available for use.

Possible values are `"author"`, `"baseModels"`, `"cardData"`, `"childrenModelCount"`, `"config"`, `"createdAt"`, `"disabled"`, `"downloads"`, `"downloadsAllTime"`, `"gated"`, `"gguf"`, `"inference"`, `"lastModified"`, `"library_name"`, `"likes"`, `"mask_token"`, `"model-index"`, `"pipeline_tag"`, `"private"`, `"safetensors"`, `"sha"`, `"siblings"`, `"spaces"`, `"tags"`, `"transformersInfo"`, `"trendingScore"`, `"widgetData"`, `"usedStorage"` and `"resourceGroup"`.

Example

from huggingface_hub import hf_api

info = hf_api.model_info(
    "stable-diffusion-v1-5/stable-diffusion-v1-5",
    expand=["baseModels"]
)

print(info.baseModels)
# AttributeError: 'ModelInfo' object has no attribute 'baseModels'

Additional context
I was creating a function to search for models using diffusers, but due to the lack of a method to retrieve data from hf_api, I couldn't implement it. Therefore, I would like to use it for the creation of the functions that couldn't be implemented
Also related to #2039

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions