Upload SEARCH_GUIDE.md with huggingface_hub
Browse files- SEARCH_GUIDE.md +11 -51
SEARCH_GUIDE.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
# Hub search: URLs and Python
|
| 2 |
|
| 3 |
-
This guide shows how to search models
|
| 4 |
|
| 5 |
---
|
| 6 |
|
| 7 |
## 1. Search by URL
|
| 8 |
|
| 9 |
-
You can build URLs that pre-fill the Hub search.
|
| 10 |
|
| 11 |
### Main parameters
|
| 12 |
|
|
@@ -18,9 +18,9 @@ You can build URLs that pre-fill the Hub search. There is no UI to build these y
|
|
| 18 |
|
| 19 |
### Models
|
| 20 |
|
| 21 |
-
, `author=...` for owner.
|
| 49 |
-
Example:
|
| 50 |
-
`https://huggingface.co/spaces?author=netflix`
|
| 51 |
|
| 52 |
---
|
| 53 |
|
| 54 |
## 2. Search with Python
|
| 55 |
|
| 56 |
-
The same filters are available in `huggingface_hub`
|
| 57 |
For **private** or **gated** repos, use a token (e.g. `token=True` or `token="hf_..."`).
|
| 58 |
|
| 59 |
### List models
|
|
@@ -72,56 +60,28 @@ list_models(other="conversational")
|
|
| 72 |
list_models(other="hunyuan,conversational", author="tencent-community")
|
| 73 |
```
|
| 74 |
|
| 75 |
-
### List datasets
|
| 76 |
-
|
| 77 |
-
```python
|
| 78 |
-
from huggingface_hub import list_datasets
|
| 79 |
-
|
| 80 |
-
# All datasets from an org (use token if private)
|
| 81 |
-
for repo in list_datasets(author="netflix", token=True):
|
| 82 |
-
print(repo.id) # e.g. netflix/acrostic_poem, netflix/ifeval
|
| 83 |
-
```
|
| 84 |
-
|
| 85 |
-
### List Spaces
|
| 86 |
-
|
| 87 |
-
```python
|
| 88 |
-
from huggingface_hub import list_spaces
|
| 89 |
-
|
| 90 |
-
list_spaces(author="netflix", token=True)
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
---
|
| 94 |
|
| 95 |
## 3. Example: private org "netflix"
|
| 96 |
|
| 97 |
-
If your org has these
|
| 98 |
|
| 99 |
- **Models:** `netflix/mdeberta_512_v3_base`, `netflix/my-bert-model`
|
| 100 |
-
- **Datasets:** `netflix/acrostic_poem`, `netflix/ifeval`
|
| 101 |
|
| 102 |
### URLs (logged in)
|
| 103 |
|
| 104 |
- All models from netflix:
|
| 105 |
`https://huggingface.co/models?author=netflix`
|
| 106 |
-
- All datasets from netflix:
|
| 107 |
-
`https://huggingface.co/datasets?author=netflix`
|
| 108 |
|
| 109 |
### Python (with token for private)
|
| 110 |
|
| 111 |
```python
|
| 112 |
-
from huggingface_hub import list_models
|
| 113 |
|
| 114 |
-
# Models
|
| 115 |
for m in list_models(author="netflix", token=True):
|
| 116 |
print(m.id)
|
| 117 |
# netflix/mdeberta_512_v3_base
|
| 118 |
# netflix/my-bert-model
|
| 119 |
-
|
| 120 |
-
# Datasets
|
| 121 |
-
for d in list_datasets(author="netflix", token=True):
|
| 122 |
-
print(d.id)
|
| 123 |
-
# netflix/acrostic_poem
|
| 124 |
-
# netflix/ifeval
|
| 125 |
```
|
| 126 |
|
| 127 |
---
|
|
@@ -129,13 +89,13 @@ for d in list_datasets(author="netflix", token=True):
|
|
| 129 |
## 4. Discovering tags
|
| 130 |
|
| 131 |
- On a **model repo page**, the tags are listed; **clicking a tag** takes you to the models search with that tag in `other`.
|
| 132 |
-
-
|
| 133 |
|
| 134 |
---
|
| 135 |
|
| 136 |
## 5. Full reference
|
| 137 |
|
| 138 |
-
- **URLs:** Build `https://huggingface.co/
|
| 139 |
**`author`** is the **namespace**: the org name or username (e.g. `netflix`, `tencent-community`, or a Hub username). Use the same value in URLs and in Python.
|
| 140 |
- **Python:** [Search guide](https://huggingface.co/docs/huggingface_hub/guides/search) in the docs.
|
| 141 |
- **Token:** For private/gated repos, use `token=True` (from env or cache) or `token="hf_..."` in Python; for URLs, be logged in on the site.
|
|
|
|
| 1 |
# Hub search: URLs and Python
|
| 2 |
|
| 3 |
+
This guide shows how to search models using **URL parameters** and the **Python library** (`huggingface_hub`). Use it to find repos by tag, author (user or org), and more.
|
| 4 |
|
| 5 |
---
|
| 6 |
|
| 7 |
## 1. Search by URL
|
| 8 |
|
| 9 |
+
You can build URLs that pre-fill the Hub search.
|
| 10 |
|
| 11 |
### Main parameters
|
| 12 |
|
|
|
|
| 18 |
|
| 19 |
### Models
|
| 20 |
|
| 21 |
+

|
| 22 |
|
| 23 |
+

|
| 24 |
|
| 25 |
- Base URL: `https://huggingface.co/models`
|
| 26 |
- Examples:
|
|
|
|
| 33 |
- **Tag + author**:
|
| 34 |
`https://huggingface.co/models?other=hunyuan,conversational&author=tencent-community`
|
| 35 |
|
| 36 |
+
### Path to your model
|
| 37 |
|
| 38 |
+

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
---
|
| 41 |
|
| 42 |
## 2. Search with Python
|
| 43 |
|
| 44 |
+
The same filters are available in `huggingface_hub` via `list_models`.
|
| 45 |
For **private** or **gated** repos, use a token (e.g. `token=True` or `token="hf_..."`).
|
| 46 |
|
| 47 |
### List models
|
|
|
|
| 60 |
list_models(other="hunyuan,conversational", author="tencent-community")
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
---
|
| 64 |
|
| 65 |
## 3. Example: private org "netflix"
|
| 66 |
|
| 67 |
+
If your org has these models:
|
| 68 |
|
| 69 |
- **Models:** `netflix/mdeberta_512_v3_base`, `netflix/my-bert-model`
|
|
|
|
| 70 |
|
| 71 |
### URLs (logged in)
|
| 72 |
|
| 73 |
- All models from netflix:
|
| 74 |
`https://huggingface.co/models?author=netflix`
|
|
|
|
|
|
|
| 75 |
|
| 76 |
### Python (with token for private)
|
| 77 |
|
| 78 |
```python
|
| 79 |
+
from huggingface_hub import list_models
|
| 80 |
|
|
|
|
| 81 |
for m in list_models(author="netflix", token=True):
|
| 82 |
print(m.id)
|
| 83 |
# netflix/mdeberta_512_v3_base
|
| 84 |
# netflix/my-bert-model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
```
|
| 86 |
|
| 87 |
---
|
|
|
|
| 89 |
## 4. Discovering tags
|
| 90 |
|
| 91 |
- On a **model repo page**, the tags are listed; **clicking a tag** takes you to the models search with that tag in `other`.
|
| 92 |
+
- To add and manage tags on your model, see [Model cards](https://huggingface.co/docs/hub/model-cards) (metadata and tags).
|
| 93 |
|
| 94 |
---
|
| 95 |
|
| 96 |
## 5. Full reference
|
| 97 |
|
| 98 |
+
- **URLs:** Build `https://huggingface.co/models?other=tag1,tag2&author=<namespace>`.
|
| 99 |
**`author`** is the **namespace**: the org name or username (e.g. `netflix`, `tencent-community`, or a Hub username). Use the same value in URLs and in Python.
|
| 100 |
- **Python:** [Search guide](https://huggingface.co/docs/huggingface_hub/guides/search) in the docs.
|
| 101 |
- **Token:** For private/gated repos, use `token=True` (from env or cache) or `token="hf_..."` in Python; for URLs, be logged in on the site.
|