File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,29 @@ def logout(self, token: str) -> None:
132132 def list_models (self , filter : Optional [str ] = None ) -> List [ModelInfo ]:
133133 """
134134 Get the public list of all the models on huggingface.co
135+
136+ Args:
137+ filter (:obj:`str`, `optional`):
138+ A string which can be used to identify models on the hub by their tags.
139+ Example usage:
140+
141+ >>> from huggingface_hub import HfApi
142+ >>> api = HfApi()
143+
144+ >>> # List all models
145+ >>> api.list_models()
146+
147+ >>> # List only the text classification models
148+ >>> api.list_models(filter="text-classification")
149+
150+ >>> # List only the russian models
151+ >>> api.list_models(filter="ru")
152+
153+ >>> # List only the models trained on the "common_voice" dataset
154+ >>> api.list_models(filter="dataset:common_voice")
155+
156+ >>> # List only the models from the AllenNLP library
157+ >>> api.list_models(filter="allennlp")
135158 """
136159 path = "{}/api/models" .format (self .endpoint )
137160 params = {"filter" : filter , "full" : True } if filter is not None else None
You can’t perform that action at this time.
0 commit comments