Hub Python 库文档
管理集合
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
管理集合
查看 HfApi 文档页面,参考管理 Hub 上 Space 的方法。
- 获取集合内容: get_collection()
- 创建新集合: create_collection()
- 更新集合: update_collection_metadata()
- 删除集合: delete_collection()
- 向集合添加项目: add_collection_item()
- 更新集合中的项目: update_collection_item()
- 从集合中移除项目: delete_collection_item()
Collection
class huggingface_hub.Collection
< source >( **kwargs )
参数
- slug (
str
) — 集合的 Slug。例如:"TheBloke/recent-models-64f9a55bb3115b4f513ec026"
。 - title (
str
) — 集合的标题。例如:"Recent models"
。 - owner (
str
) — 集合的所有者。例如:"TheBloke"
。 - items (
List[CollectionItem]
) — 集合中项目的列表。 - last_updated (
datetime
) — 集合最后更新的日期。 - position (
int
) — 集合在所有者的集合列表中的位置。 - private (
bool
) — 集合是否为私有。 - theme (
str
) — 集合的主题。例如:"green"
。 - upvotes (
int
) — 集合的点赞数。 - description (
str
, optional) — 集合的描述,纯文本格式。 - url (
str
) — (属性) Hub 上集合的 URL。
包含 Hub 上 Collection 的信息。
CollectionItem
class huggingface_hub.CollectionItem
< source >( _id: str id: str type: CollectionItemType_T position: int note: Optional[Dict] = None **kwargs )
包含关于 Collection 的一个项目(模型、数据集、Space 或 paper)的信息。