ztxexp.template_wizard¶
ztxexp.template_wizard
¶
Interactive template wizard for ztxexp init-template.
This module provides a command-line questionnaire and scaffold generator that produces a runnable experiment template project.
PRESET_MODULES
module-attribute
¶
SUPPORTED_METRIC_MODES
module-attribute
¶
SUPPORTED_RUN_MODES
module-attribute
¶
TEMPLATE_MARKER_FILENAME
module-attribute
¶
TemplateAnswers
dataclass
¶
Collected answers for template generation.
源代码位于: ztxexp/template_wizard.py
__init__
¶
__init__(experiment_name: str, ablation: bool, with_models_dir: bool, modules: list[str], mode: RunMode, metric_mode: MetricMode, tracker: TrackerMode) -> None
TemplateRenderResult
dataclass
¶
Template rendering result.
源代码位于: ztxexp/template_wizard.py
__init__
¶
__init__(template_dir: Path, action: str, changed: bool, dry_run: bool, warnings: list[str] = list(), files: list[Path] = list()) -> None
summary_lines
¶
Build summary lines for CLI output.
源代码位于: ztxexp/template_wizard.py
ask_template_questions
¶
ask_template_questions(name: str | None = None, yes: bool = False, input_fn: Callable[[str], str] | None = None) -> TemplateAnswers
Ask interactive questions and return normalized answers.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
name
|
str | None
|
Optional preset experiment name. |
None
|
yes
|
bool
|
If True, use recommended defaults without prompting. |
False
|
input_fn
|
Callable[[str], str] | None
|
Input function for testing or custom IO. |
None
|
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
TemplateAnswers |
TemplateAnswers
|
Normalized questionnaire results. |
源代码位于: ztxexp/template_wizard.py
build_template_plan
¶
build_template_plan(answers: TemplateAnswers, project_root: Path, output_dir: str | Path | None = None) -> dict[str, object]
Build scaffold plan from answers.
源代码位于: ztxexp/template_wizard.py
check_init_prerequisites
¶
Check optional prerequisites and return warning messages.
The check is advisory and never blocks template generation.
源代码位于: ztxexp/template_wizard.py
create_template_scaffold
¶
create_template_scaffold(plan: dict[str, object], answers: TemplateAnswers, dry_run: bool = False, force: bool = False, warnings: list[str] | None = None) -> TemplateRenderResult
Create template scaffold according to plan and answers.
源代码位于: ztxexp/template_wizard.py
is_interactive_terminal
¶
render_base_config
¶
Render base config payload for generated template.
源代码位于: ztxexp/template_wizard.py
render_template_script
¶
Render generated command-line experiment script.
源代码位于: ztxexp/template_wizard.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
resolve_project_root
¶
Resolve and validate project root directory.