@@ -2327,6 +2327,7 @@ def get_dataset_tags(self) -> dict:
23272327 hf_raise_for_status(r)
23282328 return r.json()
23292329
2330+ @_deprecate_arguments(version="2.0", deprecated_args=["model_name"], custom_message="Use `search` instead.")
23302331 @validate_hf_hub_args
23312332 def list_models(
23322333 self,
@@ -2376,9 +2377,6 @@ def list_models(
23762377 inference_provider (`Literal["all"]` or `str`, *optional*):
23772378 A string to filter models on the Hub that are served by a specific provider.
23782379 Pass `"all"` to get all models served by at least one provider.
2379- model_name (`str`, *optional*):
2380- A string that contain complete or partial names for models on the
2381- Hub, such as "bert" or "bert-base-cased"
23822380 trained_dataset (`str` or `List`, *optional*):
23832381 A string tag or a list of string tags of the trained dataset for a
23842382 model on the Hub.
@@ -2418,7 +2416,8 @@ def list_models(
24182416 token, which is the recommended method for authentication (see
24192417 https://huggingface.co/docs/huggingface_hub/quick-start#authentication).
24202418 To disable authentication, pass `False`.
2421-
2419+ model_name (`str`, *optional*):
2420+ (deprecated). Use `search` instead.
24222421
24232422 Returns:
24242423 `Iterable[ModelInfo]`: an iterable of [`huggingface_hub.hf_api.ModelInfo`] objects.
@@ -2490,7 +2489,7 @@ def list_models(
24902489 if num_parameters is not None:
24912490 params["num_parameters"] = num_parameters
24922491 search_list = []
2493- if model_name:
2492+ if model_name: # deprecated
24942493 search_list.append(model_name)
24952494 if search:
24962495 search_list.append(search)
0 commit comments