关于 nemo-data-designer-plugin
用于借助 NeMo Data Designer 创建合成数据集的工作流技能,面向需要按描述生成数据的用户。它根据需求选择交互或 Autopilot 模式,并输出包含 `load_config_builder()` 的 Python 配置文件。
主要功能
- 01按描述构建合成数据集
- 02交互或 Autopilot 工作模式
- 03支持采样器与验证列配置
- 04输出可运行的 Python 配置文件
适用场景
- 01按需求创建合成数据集
- 02让系统在 Autopilot 模式下代为选择
- 03用种子数据扩展现有记录
- 04为含 LLM 列的数据集配置模型
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ nvidia/ skills --skill nemo-data-designer-plugin安装后在 Claude Code 中输入/nemo-data-designer-plugin确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
BENCHMARK.mdskill-card.mdskill.oms.sigevals/evals.jsonreferences/nemo-platform-plugin-additions.mdperson-sampling.mdpreview-review.mdseed-datasets.mdscripts/get_person_object_schema.pyworkflows/autopilot.mdinteractive.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 和 validation 列都需要类型和参数。 例如,使用
sampler_type="category"和params=dd.CategorySamplerParams(...)。 prompt、system_prompt和expr字段中的 Jinja2 模板: 使用{{ column_name }}引用列,使用{{ column_name.field }}引用嵌套字段。SamplerColumnConfig: 接受params,而不是sampler_params。- LLM judge 评分访问:
LLMJudgeColumnConfig会生成一个嵌套字典,其中每个评分名称对应{reasoning: str, score: int}。要获取数值评分,请使用.score属性。例如,对于名为quality的评审列,若评分名称为correctness,请使用{{ quality.correctness.score }}。使用{{ quality.correctness }}会返回完整字典,而非数值评分。
故障排除
- 找不到
nemo data-designerCLI: 告知用户当前环境未安装nemo data-designer(需要 Python >= 3.11)。询问用户是否希望你创建虚拟环境并安装,或者他们更愿意自行操作。未经用户许可,不要安装任何内容。 - 预览期间发生网络错误: 沙盒环境可能阻止了出站请求。询问用户是否允许在禁用沙盒的情况下重试命令。只有在沙盒外重试也失败时,才告知用户自行运行命令。
输出模板
在当前目录创建一个 Python 文件,其中包含 load_config_builder() 函数,并返回一个 DataDesignerConfigBuilder。使用描述性文件名(例如,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