mcpField
N
nemo-data-designer-plugin

nemo-data-designer-plugin

github.com/promptingcompany数据与数据库039 次安装17 周前更新
代码仓库

关于 nemo-data-designer-plugin

nemo-data-designer-plugin 是使用 Data Designer 库构建合成数据集的技能,按交互或自动驾驶工作流引导任务,并生成 Python 配置脚本。

主要功能

  1. 01交互与自动驾驶模式
  2. 02按模式选择工作流
  3. 03合成数据集配置
  4. 04生成含内联依赖的 Python 脚本

适用场景

  1. 01根据自然语言描述构建数据集
  2. 02为含 LLM 列的数据集生成脚本

安装

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

$npx skills add https://github.com/promptingcompany/nv-skills --skill nemo-data-designer-plugin

安装后在 Claude Code 中输入/nemo-data-designer-plugin确认已加载。

包含的文件

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

BENCHMARK.md
skill-card.md
skill.oms.sig
evals/
evals.json
references/
nemo-platform-plugin-additions.md
person-sampling.md
preview-review.md
seed-datasets.md
scripts/
get_person_object_schema.py
workflows/
autopilot.md
interactive.md

详细介绍

开始之前

不要先探索工作区。工作流的 Learn 步骤会提供所需的一切。

目标

使用 Data Designer 库构建一个符合以下描述的合成数据集:

$ARGUMENTS

工作流

如果用户表示不想回答问题,请使用 Autopilot 模式——例如,用户说“按你的判断来”“你来决定”“做出合理假设”“直接构建”“给我惊喜”等。否则,使用 Interactive 模式(默认)。

只读取与所选模式对应的工作流文件,然后按其中的说明操作:

  • Interactive → 读取 workflows/interactive.md
  • Autopilot → 读取 workflows/autopilot.md

规则

  • 默认保留输出中的所有列。只有在以下情况才可删除列:(1) 用户明确要求;或 (2) 该列是仅用于派生其他列的辅助列(例如,用于提取姓名、城市等信息的采样人物对象)。如有疑问,请保留该列。
  • 不要建议或询问是否使用种子数据集。只有在用户明确提供种子数据或要求基于现有记录构建时,才使用种子数据集。使用种子数据集时,请读取 references/seed-datasets.md。
  • 如果数据集需要人物数据(姓名、人口统计信息、地址),请读取 references/person-sampling.md。
  • 如果已经存在与数据集描述匹配的数据集脚本,请询问用户是要编辑该脚本还是新建一个。
  • 对于此 NeMo Platform 插件特有的命令和上下文(例如,从 IGW 提供商获取模型配置或在脚本中使用 ModelConfig、安装或发布 Nemotron Personas locales、平台端资源指针),请读取 references/nemo-platform-plugin-additions.md。

使用技巧和常见问题

  • 采样器和验证列都需要类型和参数。 例如,sampler_type="category" 搭配 params=dd.CategorySamplerParams(...)。
  • prompt、system_prompt 和 expr 字段中的 Jinja2 模板: 使用 {{ column_name }} 引用列,使用 {{ column_name.field }} 引用嵌套字段。
  • **SamplerColumnConfig:** 使用 params,而不是 sampler_params。
  • LLM 评判器分数的访问方式: LLMJudgeColumnConfig 会生成一个嵌套字典,其中每个分数名称都映射到 {reasoning: str, score: int}。要获取数值分数,请使用 .score 属性。例如,对于名为 quality、分数名为 correctness 的评判器列,请使用 {{ quality.correctness.score }}。使用 {{ quality.correctness }} 会返回完整字典,而非数值分数。

故障排除

  • **nemo data-designer CLI 未找到:** 告知用户当前环境未安装 nemo data-designer(需要 Python >= 3.11)。询问用户是否希望你创建虚拟环境并安装,或者他们更愿意自行操作。未经用户许可,不要安装任何内容。
  • 预览期间发生网络错误: 沙盒环境可能阻止了出站请求。请征求用户许可,以在禁用沙盒的情况下重试命令。只有在最后手段下,如果在沙盒外重试也失败,才告知用户需要自行运行该命令。

输出模板

在当前目录中编写一个 Python 文件,其中包含一个返回 DataDesignerConfigBuilder 的 load_config_builder() 函数。为文件取一个有描述性的名称(例如,customer_reviews.py)。使用 PEP 723 内联元数据声明依赖项。

# /// script
# dependencies = [
#   "data-designer", # always required
#   "pydantic", # only if this script imports from pydantic
#   # add additional dependencies here
# ]
# ///
import data_designer.config as dd
from pydantic import BaseModel, Field


# Use Pydantic models when the output needs to conform to a specific schema
class MyStructuredOutput(BaseModel):
    field_one: str = Field(description="...")
    field_two: int = Field(description="...")


# Use custom generators when built-in column types aren't enough
@dd.custom_column_generator(
    required_columns=["col_a"],
    side_effect_columns=["extra_col"],
)
def generator_function(row: dict) -> dict:
    # add custom logic here that depends on "col_a" and update row in place
    row["name_in_custom_column_config"] = "custom value"
    row["extra_col"] = "extra value"
    return row


def load_config_builder() -> dd.DataDesignerConfigBuilder:
    config_builder = dd.DataDesignerConfigBuilder(
        # Declaring model configs programmatically here is the portable path:
        # it works for both local `run` and cluster `submit`, while the local
        # YAML registry alternative only works for `run`. The provider below
        # is a common default created during `nemo setup` — confirm it (or
        # discover others) with `nemo inference providers list`. See
        # references/nemo-platform-plugin-additions.md for the local-YAML alternative.
        model_configs=[
            dd.ModelConfig(
                alias="text",
                model="...",
                provider="default/nvidia-build",
                inference_parameters=dd.ChatCompletionInferenceParams(),
            ),
        ],
    )

    # Seed dataset (only if the user explicitly mentions a seed dataset path)
    # config_builder.with_seed_dataset(dd.LocalFileSeedSource(path="path/to/seed.parquet"))

    # config_builder.add_column(...)
    # config_builder.add_processor(...)

    return config_builder

仅在任务需要时才包含 Pydantic 模型、自定义生成器、种子数据集和额外依赖项。如果数据集使用 LLM 列,优先包含 model_configs——在脚本中声明它可使配置在本地 run 和集群 submit 之间保持可移植,而本地 YAML 注册表方案仅适用于 run。

评论

支持 Markdown