How to get all model revisions

Many models now have their checkpoints shared (e.g. allenai/OLMo-1B at main )
But it is often hard to recreate by code the naming conventions of the revisions (e.g., in the example above, the tokens seen is not a series one can compute).
Is there a way to ask the hub (or github API?) for a list of all the revisions a model has?

nonworking code example

import hub
revision_list = hub.get_revision("olmo-7B")
for rev in revision_list:
print(rev) # StepxTokensY

hi @borgr ,

You get all the repo references using our API

!pip -q install huggingface_hub
from huggingface_hub import HfApi
api = HfApi()
api.list_repo_refs("allenai/OLMo-7B")
1 Like

For future readers:

!pip -q install huggingface_hub
from huggingface_hub import HfApi
api = HfApi()
refs = api.list_repo_refs("allenai/OLMo-7B")
for branch in refs.branches:
   name = branch.name
1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.