Hub documentation
嵌入图谱
单点登录(SSO) 审计日志 存储区域 用于私有数据集的 Data Studio 资源组(访问控制) 高级计算选项 高级安全 令牌管理 服务账号 发布者分析 门控组集合 网络安全 下载分析 速率限制 博客文章
PRO 计划 仓库 入门仓库 仓库设置 存储限制 存储后端(Xet) 本地缓存 Pull Requests 与 Discussions 通知 集合 Webhooks GitHub Actions Notebooks 后续步骤 许可证
模型 数据集 数据集概述 数据集卡片 受控数据集 上传数据集 上传数据集(用于 LLM) 下载数据集 流式数据集 集成库
Spaces Argilla Daft Dask 数据集 数据设计师 Distilabel DuckDB 嵌入图谱 fenic FiftyOne Lance Pandas Polars Spark WebDataset
Data Studio Agent 轨迹 数据集下载统计 Spaces 概览 Spaces GPU 升级 Spaces ZeroGPU Spaces 开发模式 Spaces 磁盘使用量与存储 Spaces 自定义域名 Spaces 作为 MCP 服务器 Spaces 作为智能体工具 将 Spaces 用作 API 端点 Gradio Spaces Streamlit Spaces 静态 HTML Spaces Docker Spaces 嵌入您的 Space 使用 Docker 运行 Spaces Spaces 配置参考 使用 HF 登录按钮 精选 Spaces Spaces 更新日志 高级主题
存储桶 new 容器镜像 new 任务 智能体 智能体概述 Hugging Face AI 智能体 CLI Hugging Face MCP 服务器 Hugging Face Agent Skills 使用 HF SDK 构建智能体 使用 llama.cpp 的本地代理 Agent 库 会话跟踪格式
其他 嵌入图谱
Embedding Atlas 是一款用于探索大型嵌入空间的交互式可视化工具。它支持您可视化、交叉筛选和搜索嵌入及其关联的元数据,帮助您理解高维数据中的模式和关系。所有计算均在您的计算机上完成,确保您的数据保持私密和安全。
以下是作为静态 Space 托管的 MegaScience 数据集的示例图集:
主要功能
- 交互式探索:通过流畅、响应迅速的可视化界面浏览数百万个嵌入
- 基于浏览器的计算:在本地计算嵌入和投影,无需将数据发送到外部服务器
- 交叉筛选:在多个元数据列之间关联并筛选数据
- 搜索功能:查找与给定查询或现有项目相似的数据点
- 多种集成选项:可通过命令行、Jupyter 小部件或 Web 界面使用
先决条件
首先,安装 Embedding Atlas:
pip install embedding-atlas
如果您计划从 Hugging Face Hub 加载私有数据集,还需要使用您的 Hugging Face 账户登录:
hf auth login
从 Hub 加载数据集
Embedding Atlas 与 Hugging Face Hub 无缝集成,允许您直接可视化来自任何数据集的嵌入。
使用命令行
通过命令行界面可视化 Hugging Face 数据集是最简单的方法。使用 IMDB 数据集试试:
# Load the IMDB dataset from the Hub
embedding-atlas stanfordnlp/imdb
# Specify the text column for embedding computation
embedding-atlas stanfordnlp/imdb --text "text"
# Load only a sample for faster exploration
embedding-atlas stanfordnlp/imdb --text "text" --sample 5000对于您自己的数据集,请使用相同的模式:
# Load your dataset from the Hub
embedding-atlas username/dataset-name
# Load multiple splits
embedding-atlas username/dataset-name --split train --split test
# Specify custom text column
embedding-atlas username/dataset-name --text "content"使用 Python 和 Jupyter
您还可以在 Jupyter notebook 中使用 Embedding Atlas 进行交互式探索:
from embedding_atlas.widget import EmbeddingAtlasWidget
from datasets import load_dataset
import pandas as pd
# Load the IMDB dataset from Hugging Face Hub
dataset = load_dataset("stanfordnlp/imdb", split="train[:5000]")
# Convert to pandas DataFrame
df = dataset.to_pandas()
# Create interactive widget
widget = EmbeddingAtlasWidget(df)
widget对于您自己的数据集:
from embedding_atlas.widget import EmbeddingAtlasWidget
from datasets import load_dataset
import pandas as pd
# Load your dataset from the Hub
dataset = load_dataset("username/dataset-name", split="train")
df = dataset.to_pandas()
# Create interactive widget
widget = EmbeddingAtlasWidget(df)
widget使用预计算嵌入
如果您拥有包含预计算嵌入的数据集,可以直接加载它们:
# Load dataset with pre-computed coordinates
embedding-atlas username/dataset-name \
--x "embedding_x" \
--y "embedding_y"
# Load with pre-computed nearest neighbors
embedding-atlas username/dataset-name \
--neighbors "neighbors_column"自定义嵌入
Embedding Atlas 默认使用 SentenceTransformers,但也支持自定义嵌入模型:
# Use a specific embedding model
embedding-atlas stanfordnlp/imdb \
--text "text" \
--model "sentence-transformers/all-MiniLM-L6-v2"
# For models requiring remote code execution
embedding-atlas username/dataset-name \
--model "custom/model" \
--trust-remote-codeUMAP 投影参数
针对您的特定用例微调降维:
embedding-atlas stanfordnlp/imdb \
--text "text" \
--umap-n-neighbors 30 \
--umap-min-dist 0.1 \
--umap-metric "cosine"用例
探索文本数据集
可视化和探索文本语料库,以识别聚类、异常值和模式:
from embedding_atlas.widget import EmbeddingAtlasWidget
from datasets import load_dataset
import pandas as pd
# Load a text classification dataset
dataset = load_dataset("stanfordnlp/imdb", split="train[:5000]")
df = dataset.to_pandas()
# Visualize with metadata
widget = EmbeddingAtlasWidget(df)
widget