mcpField
H
huggingface-paper-publisher

huggingface-paper-publisher

github.com/huggingface文档处理11.2k1.7k 次安装5 天前更新
代码仓库

关于 huggingface-paper-publisher

huggingface-paper-publisher 为 AI 工程师和研究人员提供在 Hugging Face Hub 发布、管理和关联研究论文的工具。它涵盖 arXiv 论文索引、作者认领、模型或数据集关联,以及研究文章模板生成。

主要功能

  1. 01从 arXiv 索引论文
  2. 02认领并验证论文作者身份
  3. 03控制论文个人主页可见性
  4. 04关联论文与模型或数据集
  5. 05生成并转换研究文章

适用场景

  1. 01将 arXiv 论文加入 Hugging Face
  2. 02为模型或数据集补充论文引用
  3. 03验证作者身份并管理主页论文
  4. 04从模板创建研究文章

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/huggingface/skills --skill huggingface-paper-publisher

安装后在 Claude Code 中输入/huggingface-paper-publisher确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

examples/
example_usage.md
references/
quick_reference.md
scripts/
paper_manager.py
templates/
arxiv.md
ml-report.md
modern.md
standard.md

详细介绍

概述

此技能为 AI 工程师和研究人员提供全面的工具,用于在 Hugging Face Hub 上发布、管理和关联研究论文。它简化了从创建论文到发布的工作流,包括与 arXiv 集成、关联模型/数据集以及管理作者信息。

与 HF 生态系统集成

  • 论文页面:在 Hugging Face Hub 上索引和发现论文
  • arXiv 集成:根据 arXiv ID 自动索引论文
  • 模型/数据集关联:通过元数据将论文与相关成果关联起来
  • 作者身份验证:认领并验证论文作者身份
  • 研究文章模板:生成专业、现代的科学论文

版本

1.0.0

依赖项

随附脚本使用 PEP 723 内联依赖项。建议使用 uv run,而不是 手动设置环境。

  • huggingface_hub>=0.26.0
  • pyyaml>=6.0.3
  • requests>=2.32.5
  • markdown>=3.5.0
  • python-dotenv>=1.2.1

核心功能

1. 论文页面管理

  • 索引论文:将 arXiv 论文添加到 Hugging Face
  • 认领作者身份:验证并认领已发布论文的作者身份
  • 管理可见性:控制哪些论文会显示在个人资料中
  • 论文发现:查找并探索 HF 生态系统中的论文

2. 将论文关联到成果

  • 模型卡片:在模型元数据中添加论文引用
  • 数据集卡片:通过 README 将论文关联到数据集
  • 自动添加标签:Hub 自动生成 arxiv:<PAPER_ID> 标签
  • 引用管理:维护正确的署名和参考文献

3. 创建研究文章

  • Markdown 模板:生成专业的论文排版
  • 现代设计:简洁易读的研究文章版式
  • 动态目录:自动生成目录
  • 章节结构:采用标准科学论文结构
  • LaTeX 数学公式:支持公式和技术符号

4. 元数据管理

  • YAML Frontmatter:规范的模型/数据集卡片元数据
  • 引用追踪:在各个仓库中维护论文引用
  • 版本控制:追踪论文更新和修订
  • 多论文支持:将多篇论文关联到单个成果

使用说明

此技能在 scripts/ 中包含用于论文发布操作的 Python 脚本。

前提条件
  • 使用 uv run 运行脚本(依赖项会从脚本头部解析)
  • 设置 HF_TOKEN 环境变量,并使用具有写入权限的令牌

所有路径均相对于包含此 SKILL.md 文件的目录。 运行任何脚本之前,请先 cd 到该目录,或使用完整 路径。

方法 1:从 arXiv 索引论文

将 arXiv 论文添加到 Hugging Face Paper Pages。

基本用法:

uv run scripts/paper_manager.py index \
  --arxiv-id "2301.12345"

检查论文是否已存在:

uv run scripts/paper_manager.py check \
  --arxiv-id "2301.12345"

直接通过 URL 访问: 你也可以直接访问 https://huggingface.co/papers/{arxiv-id} 来索引论文。

方法 2:将论文关联到模型/数据集

在模型或数据集 README 中添加论文引用,并使用正确的 YAML 元数据。

添加到模型卡片:

uv run scripts/paper_manager.py link \
  --repo-id "username/model-name" \
  --repo-type "model" \
  --arxiv-id "2301.12345"

添加到数据集卡片:

uv run scripts/paper_manager.py link \
  --repo-id "username/dataset-name" \
  --repo-type "dataset" \
  --arxiv-id "2301.12345"

添加多篇论文:

uv run scripts/paper_manager.py link \
  --repo-id "username/model-name" \
  --repo-type "model" \
  --arxiv-ids "2301.12345,2302.67890,2303.11111"

使用自定义引用:

uv run scripts/paper_manager.py link \
  --repo-id "username/model-name" \
  --repo-type "model" \
  --arxiv-id "2301.12345" \
  --citation "$(cat citation.txt)"
关联方式

将 arXiv 论文链接添加到模型或数据集 README 后:

  1. Hub 会从链接中提取 arXiv ID
  2. 仓库会自动添加 arxiv:<PAPER_ID> 标签
  3. 用户可以点击该标签查看论文页面
  4. 论文页面会显示所有引用该论文的模型/数据集
  5. 可以通过筛选条件和搜索发现论文
方法 3:认领作者身份

验证你在 Hugging Face 上发布的论文中的作者身份。

开始认领流程:

uv run scripts/paper_manager.py claim \
  --arxiv-id "2301.12345" \
  --email "[email protected]"

手动流程:

  1. 前往论文页面:https://huggingface.co/papers/{arxiv-id}
  2. 在作者列表中找到你的姓名
  3. 点击你的姓名,然后选择“认领作者身份”
  4. 等待管理员团队验证

检查作者身份状态:

uv run scripts/paper_manager.py check-authorship \
  --arxiv-id "2301.12345"
方法 4:管理论文可见性

控制哪些已验证的论文会显示在你的公开个人资料中。

列出你的论文:

uv run scripts/paper_manager.py list-my-papers

切换可见性:

uv run scripts/paper_manager.py toggle-visibility \
  --arxiv-id "2301.12345" \
  --show true

在设置中管理: 前往账户设置 → Papers 部分,为每篇论文切换“Show on profile”。

方法 5:创建研究文章

使用现代模板生成专业的 Markdown 研究论文。

从模板创建:

uv run scripts/paper_manager.py create \
  --template "standard" \
  --title "Your Paper Title" \
  --output "paper.md"

可用模板:

  • standard - 传统科学论文结构
  • modern - 受 Distill 启发的简洁、适合网页的格式
  • arxiv - arXiv 风格的排版
  • ml-report - 机器学习实验报告

生成完整论文:

uv run scripts/paper_manager.py create \
  --template "modern" \
  --title "Fine-Tuning Large Language Models with LoRA" \
  --authors "Jane Doe, John Smith" \
  --abstract "$(cat abstract.txt)" \
  --output "paper.md"

转换为 HTML:

uv run scripts/paper_manager.py convert \
  --input "paper.md" \
  --output "paper.html" \
  --style "modern"
论文模板结构

标准研究论文章节:

---
title: Your Paper Title
authors: Jane Doe, John Smith
affiliations: University X, Lab Y
date: 2025-01-15
arxiv: 2301.12345
tags: [machine-learning, nlp, fine-tuning]
---

# Abstract
Brief summary of the paper...

# 1. Introduction
Background and motivation...

# 2. Related Work
Previous research and context...

# 3. Methodology
Approach and implementation...

# 4. Experiments
Setup, datasets, and procedures...

# 5. Results
Findings and analysis...

# 6. Discussion
Interpretation and implications...

# 7. Conclusion
Summary and future work...

# References

现代模板功能:

  • 动态目录
  • 适用于网页浏览的响应式设计
  • 代码语法高亮
  • 交互式图表
  • 数学公式渲染(LaTeX)
  • 引文管理
  • 作者所属机构链接
命令参考

索引论文:

uv run scripts/paper_manager.py index --arxiv-id "2301.12345"

链接到代码仓库:

uv run scripts/paper_manager.py link \
  --repo-id "username/repo-name" \
  --repo-type "model|dataset|space" \
  --arxiv-id "2301.12345" \
  [--citation "Full citation text"] \
  [--create-pr]

认领作者身份:

uv run scripts/paper_manager.py claim \
  --arxiv-id "2301.12345" \
  --email "your.email@edu"

管理可见性:

uv run scripts/paper_manager.py toggle-visibility \
  --arxiv-id "2301.12345" \
  --show true|false

创建研究文章:

uv run scripts/paper_manager.py create \
  --template "standard|modern|arxiv|ml-report" \
  --title "Paper Title" \
  [--authors "Author1, Author2"] \
  [--abstract "Abstract text"] \
  [--output "filename.md"]

将 Markdown 转换为 HTML:

uv run scripts/paper_manager.py convert \
  --input "paper.md" \
  --output "paper.html" \
  [--style "modern|classic"]

检查论文状态:

uv run scripts/paper_manager.py check --arxiv-id "2301.12345"

列出你的论文:

uv run scripts/paper_manager.py list-my-papers

搜索论文:

uv run scripts/paper_manager.py search --query "transformer attention"
YAML 元数据格式

将论文链接到模型或数据集时,必须使用正确的 YAML frontmatter:

模型卡片示例:

---
language:
  - en
license: apache-2.0
tags:
  - text-generation
  - transformers
  - llm
library_name: transformers
---

# Model Name

This model is based on the approach described in [Our Paper](https://arxiv.org/abs/2301.12345).

## Citation

```bibtex
@article{doe2023paper,
  title={Your Paper Title},
  author={Doe, Jane and Smith, John},
  journal={arXiv preprint arXiv:2301.12345},
  year={2023}
}

**Dataset Card Example:**
```yaml
---
language:
  - en
license: cc-by-4.0
task_categories:
  - text-generation
  - question-answering
size_categories:
  - 10K<n<100K
---

# Dataset Name

Dataset introduced in [Our Paper](https://arxiv.org/abs/2301.12345).

For more details, see the [paper page](https://huggingface.co/papers/2301.12345).

Hub 会自动从这些链接中提取 arXiv ID,并创建 arxiv:2301.12345 标签。

集成示例

工作流 1:发布新研究

# 1. Create research article
uv run scripts/paper_manager.py create \
  --template "modern" \
  --title "Novel Fine-Tuning Approach" \
  --output "paper.md"

# 2. Edit paper.md with your content

# 3. Submit to arXiv (external process)
# Upload to arxiv.org, get arXiv ID

# 4. Index on Hugging Face
uv run scripts/paper_manager.py index --arxiv-id "2301.12345"

# 5. Link to your model
uv run scripts/paper_manager.py link \
  --repo-id "your-username/your-model" \
  --repo-type "model" \
  --arxiv-id "2301.12345"

# 6. Claim authorship
uv run scripts/paper_manager.py claim \
  --arxiv-id "2301.12345" \
  --email "your.email@edu"

工作流 2:链接现有论文

# 1. Check if paper exists
uv run scripts/paper_manager.py check --arxiv-id "2301.12345"

# 2. Index if needed
uv run scripts/paper_manager.py index --arxiv-id "2301.12345"

# 3. Link to multiple repositories
uv run scripts/paper_manager.py link \
  --repo-id "username/model-v1" \
  --repo-type "model" \
  --arxiv-id "2301.12345"

uv run scripts/paper_manager.py link \
  --repo-id "username/training-data" \
  --repo-type "dataset" \
  --arxiv-id "2301.12345"

uv run scripts/paper_manager.py link \
  --repo-id "username/demo-space" \
  --repo-type "space" \
  --arxiv-id "2301.12345"

工作流 3:使用论文引用更新模型

# 1. Get current README
hf download username/model-name README.md

# 2. Add paper link
uv run scripts/paper_manager.py link \
  --repo-id "username/model-name" \
  --repo-type "model" \
  --arxiv-id "2301.12345" \
  --citation "Full citation for the paper"

# The script will:
# - Add YAML metadata if missing
# - Insert arXiv link in README
# - Add formatted citation
# - Preserve existing content
最佳实践
  1. 论文索引

    • 论文在 arXiv 上发布后,尽快为其编制索引
    • 在模型卡片/数据集卡片中包含完整的引文信息
    • 在相关代码仓库中使用一致的论文引用
  2. 元数据管理

    • 为所有模型卡片/数据集卡片添加 YAML frontmatter
    • 包含正确的许可信息
    • 添加相关任务类别和领域标签
  3. 作者身份

    • 认领列有你姓名的论文的作者身份
    • 使用机构邮箱进行验证
    • 及时更新论文可见性设置
  4. 代码仓库链接

    • 将论文链接到所有相关模型、数据集和 Spaces
    • 在 README 描述中加入论文背景信息
    • 添加 BibTeX 引文以便引用
  5. 研究文章

    • 在项目中统一使用模板
    • 在论文中包含代码和数据链接
    • 生成适合网页浏览的 HTML 版本以便分享
高级用法

批量链接论文:

# Link multiple papers to one repository
for arxiv_id in "2301.12345" "2302.67890" "2303.11111"; do
  uv run scripts/paper_manager.py link \
    --repo-id "username/model-name" \
    --repo-type "model" \
    --arxiv-id "$arxiv_id"
done

提取论文信息:

# Get paper metadata from arXiv
uv run scripts/paper_manager.py info \
  --arxiv-id "2301.12345" \
  --format "json"

生成引文:

# Create BibTeX citation
uv run scripts/paper_manager.py citation \
  --arxiv-id "2301.12345" \
  --format "bibtex"

验证链接:

# Check all paper links in a repository
uv run scripts/paper_manager.py validate \
  --repo-id "username/model-name" \
  --repo-type "model"
错误处理
  • 找不到论文:arXiv ID 不存在或尚未编入索引
  • 权限被拒绝:HF_TOKEN 缺少对代码仓库的写入权限
  • YAML 无效:README frontmatter 中的元数据格式错误
  • 作者身份认领失败:邮箱与论文作者记录不匹配
  • 已被认领:其他用户已认领作者身份
  • 速率限制:短时间内 API 请求过多
故障排除

问题:“在 Hugging Face 上找不到论文”

  • 解决方案:访问 hf.co/papers/{arxiv-id} 以触发索引

问题:“作者身份认领尚未验证”

  • 解决方案:等待管理员审核,或向 HF 支持团队提供证明并联系他们

问题:“未显示 arXiv 标签”

  • 解决方案:确保 README 中包含正确格式的 arXiv URL

问题:“无法链接到代码仓库”

  • 解决方案:确认 HF_TOKEN 具有写入权限

问题:“模板渲染错误”

  • 解决方案:检查 Markdown 语法和 YAML frontmatter 格式
资源与参考资料
与 tfrere 的研究模板集成

此技能通过提供以下功能,与 tfrere 的研究文章模板 相辅相成:

  • 自动化论文索引工作流
  • 仓库链接功能
  • 元数据管理工具
  • 引用生成工具

你可以使用 tfrere 的模板撰写论文,然后使用此技能在 Hugging Face Hub 上发布论文并添加链接。

常见模式

模式 1:发布新论文

# Write → Publish → Index → Link
uv run scripts/paper_manager.py create --template modern --output paper.md
# (Submit to arXiv)
uv run scripts/paper_manager.py index --arxiv-id "2301.12345"
uv run scripts/paper_manager.py link --repo-id "user/model" --arxiv-id "2301.12345"

模式 2:发现现有论文

# Search → Check → Link
uv run scripts/paper_manager.py search --query "transformers"
uv run scripts/paper_manager.py check --arxiv-id "2301.12345"
uv run scripts/paper_manager.py link --repo-id "user/model" --arxiv-id "2301.12345"

模式 3:管理作者作品集

# Claim → Verify → Organize
uv run scripts/paper_manager.py claim --arxiv-id "2301.12345"
uv run scripts/paper_manager.py list-my-papers
uv run scripts/paper_manager.py toggle-visibility --arxiv-id "2301.12345" --show true
API 集成

Python 脚本示例:

from scripts.paper_manager import PaperManager

pm = PaperManager(hf_token="your_token")

# Index paper
pm.index_paper("2301.12345")

# Link to model
pm.link_paper(
    repo_id="username/model",
    repo_type="model",
    arxiv_id="2301.12345",
    citation="Full citation text"
)

# Check status
status = pm.check_paper("2301.12345")
print(status)
未来改进

未来版本计划推出以下功能:

  • 支持非 arXiv 论文(会议论文集、期刊)
  • 根据 DOI 自动生成引用格式
  • 论文比较和版本管理工具
  • 协作撰写论文功能
  • 与 LaTeX 工作流集成
  • 自动提取图表和表格
  • 论文指标与影响力跟踪

评论

支持 Markdown