Subcategory columns cannot use a category parent with numeric values
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Start with DataSchema.validate_subcategory_columns_if_present in engine/sampling_gen/schema.py and the lookup in SubcategorySampler.inject_data_column in engine/sampling_gen/data_sources/sources.py. Read the existing cases in tests/engine/sampling_gen/test_schema.py and test_generator.py, then add regression coverage for numeric parent values and their string keys. Done when numeric values generate the expected pairs and missing or extra keys still fail validation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Priority Level
Medium (Annoying but has workaround)
Describe the bug
A category sampler accepts numeric values (CategorySamplerParams.values: list[str | int | float]), but a subcategory column can never use such a category as its parent. SubcategorySamplerParams.values is dict[str, list[...]], so the keys have to be strings (integer keys are rejected by Pydantic, and JSON/YAML configs always have string keys). The engine then compares those string keys to the raw category values:
DataSchema.validate_subcategory_columns_if_present(engine/sampling_gen/schema.py) buildscat_vals = set(cat.params.values)and takes the symmetric difference with the subcategory keys, so{1, 2}vs{"1", "2"}always fails.SubcategorySampler.inject_data_column(engine/sampling_gen/data_sources/sources.py) looks upself.params.values[cat_value]with the numeric cell value, which would raiseKeyErroreven if validation passed.
DataDesignerConfigBuilder.build() accepts the config, so the failure only shows up at generation time.
Steps/Code to reproduce bug
import data_designer.config as dd
from data_designer.interface import DataDesigner
builder = dd.DataDesignerConfigBuilder()
builder.add_column(dd.SamplerColumnConfig(name="grade", sampler_type="category", params=dd.CategorySamplerParams(values=[1, 2, 3])))
builder.add_column(
dd.SamplerColumnConfig(
name="topic",
sampler_type="subcategory",
params=dd.SubcategorySamplerParams(category="grade", values={"1": ["counting"], "2": ["addition"], "3": ["fractions"]}),
)
)
DataDesigner().preview(builder, num_records=5)
On main (861a082):
data_designer.interface.errors.DataDesignerGenerationError: DatasetGenerationError: Generator failed for column 'grade' during from-scratch generation: 1 validation error for DataSchema
Value error, Subcategory column 'topic' must have values for each value of its parent category 'grade'. The following values need attention: {1, '1', 2, 3, '2', '3'}
The error lists both 1 and '1', and there is no key type that satisfies it.
Expected behavior
Numeric category values match their string keys (1 -> "1", 0.5 -> "0.5"), so the preview produces grade/topic pairs such as 1 counting, 3 fractions. Missing or extra keys should still be reported as today.
Prior Investigation
Traced the error to DataSchema.validate_subcategory_columns_if_present and the lookup in SubcategorySampler; the existing subcategory tests in tests/engine/sampling_gen/test_schema.py and test_generator.py only use string parent values. Searched open and closed issues and PRs for subcategory, SubcategorySampler and numeric category values; #614 and #628 validate the parent column type but do not touch value matching, and #1201 is an unrelated feature request.
Workaround today is to make the parent values strings, which changes the column dtype.
Proposed fix: compare str(value) of the parent category values (including conditional params) with the subcategory keys in the schema validator, and look up values[str(cat_value)] in SubcategorySampler. String parents behave exactly as before. I have the fix and regression tests ready and can open a PR once this is triaged.
Checklist
- I reproduced this issue or provided a minimal example
- I searched the docs/issues myself
- Ngôn ngữ chính
- Python
- Star
- 2.4k
- Fork
- 258
- Merge trung bình
- 4 ngày 20 phút
- Pull request đã merge (30 ngày)
- 32
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NVIDIA-NeMo/DataDesigner
-
Judge score profiler samples reasoning with squared category weights, crowding out uncommon scoresĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
NVIDIA-NeMo/DataDesigner#1202 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Local seed path containing a single quote breaks the DuckDB queryCó thể đã có người làm @xubenqiang đã nhận 38 ngày trước. Đang mởbug triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
NVIDIA-NeMo/DataDesigner#1102 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enforce \from future import annotations` via ruff FA102 rule`Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởtask
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA-NeMo/DataDesigner#760 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NVIDIA-NeMo/DataDesigner#1205 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
NVIDIA-NeMo/DataDesigner#1204 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của NVIDIA-NeMo/DataDesigner
Issue tương tự
-
docs(contributing): the two things that silently block a PRCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởavailable documentation good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 95/100
Nixitov/Riptide-Native#944 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
JTHCode/secretguard#24 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: middleware documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainer thường phản hồi trong vòng 1 ngày