tao-train-mask-auto-label

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MAL

MAL

MAL (Mask Auto-Label) for weakly-supervised segmentation. Produces segmentation masks from minimal annotations (e.g., point or box annotations). Uses ViT-MAE backbone.
Set train.pretrained_model_path for ViT-MAE pretrained weights.
MAL(Mask Auto-Label)用于弱监督分割任务,仅需少量标注(如点标注或框标注)即可生成分割掩码,采用ViT-MAE骨干网络。
设置train.pretrained_model_path以指定ViT-MAE预训练权重路径。

Dataclass Schemas

Dataclass Schemas

Generated TAO Core schemas are packaged in
schemas/<action>.schema.json
, with
schemas/manifest.json
listing available actions. Each generated schema also emits
references/spec_template_<action>.yaml
from the schema top-level
default
field. AutoML enablement is declared at the model layer in
references/skill_info.yaml
via
automl_enabled
. Runnable AutoML still requires
schemas/train.schema.json
and
references/spec_template_train.yaml
to exist and parse. Use the packaged train schema for
automl_default_parameters
,
automl_disabled_parameters
, defaults, min/max bounds, enums, option weights, math conditions, dependencies, and popular parameters. Do not expect
~/tao-core
at runtime; maintainers regenerate schemas/templates before packaging the skill bank.
生成的TAO Core schema打包在
schemas/<action>.schema.json
中,
schemas/manifest.json
会列出所有可用操作。每个生成的schema还会从schema顶层的
default
字段生成
references/spec_template_<action>.yaml
。AutoML启用状态在
references/skill_info.yaml
的模型层通过
automl_enabled
声明。可运行的AutoML仍要求
schemas/train.schema.json
references/spec_template_train.yaml
存在且可解析。使用打包的训练schema来配置
automl_default_parameters
automl_disabled_parameters
、默认值、最小/最大边界、枚举值、选项权重、数学条件、依赖关系以及常用参数。运行时不要依赖
~/tao-core
;维护人员在打包技能库前会重新生成schema和模板。

Train Action Policy

Train Action Policy

This model is AutoML-enabled at the model layer. Before handling any train-stage request, read
references/skill_info.yaml
and resolve the run override from either an explicit
automl_policy
value or the user's workflow request. Treat phrases like "turn off AutoML", "disable AutoML", "no HPO", or "plain training" as
automl_policy: off
for this run only; otherwise default to
auto
. When
automl_policy: auto
,
automl_enabled: true
, and both
schemas/train.schema.json
and
references/spec_template_train.yaml
are packaged, route the train action through
tao-skill-bank:tao-run-automl
by default with this model's
skill_dir
. Preserve workflow/application overrides for datasets, specs, output directories, GPU/platform settings, parent checkpoints, and
automl_policy
. Use direct model training only when
automl_policy: off
or the packaged train schema/template is missing; in the missing-schema case, report that AutoML is enabled but not runnable for this model until schemas are generated.
Non-train actions such as
evaluate
,
inference
,
export
, and deploy flows stay in this model skill. The per-run
automl_policy
override does not change model metadata.
该模型在模型层支持AutoML。处理任何训练阶段请求前,请读取
references/skill_info.yaml
,并通过显式的
automl_policy
值或用户的工作流请求确定运行覆盖规则。将“turn off AutoML”、“disable AutoML”、“no HPO”或“plain training”这类表述视为本次运行的
automl_policy: off
;否则默认使用
auto
。当
automl_policy: auto
automl_enabled: true
,且
schemas/train.schema.json
references/spec_template_train.yaml
已打包时,默认将训练操作通过
tao-skill-bank:tao-run-automl
路由,并传入该模型的
skill_dir
。保留数据集、配置、输出目录、GPU/平台设置、父检查点和
automl_policy
的工作流/应用覆盖规则。仅当
automl_policy: off
或打包的训练schema/模板缺失时,才使用直接模型训练;若schema缺失,需报告该模型已启用AutoML,但在生成schema前无法运行。
非训练操作(如
evaluate
inference
export
和部署流程)仍在该模型技能中执行。每次运行的
automl_policy
覆盖规则不会更改模型元数据。

Training Requirements

Training Requirements

  • Dataset type: segmentation
  • Formats: default
  • Monitoring metric: mIoU
  • 数据集类型: 分割数据集
  • 格式: 默认格式
  • 监控指标: mIoU

Per-Action Dataset Requirements

各操作的数据集要求

ActionSpec KeySourceFilesList?
evaluatedataset.val_img_direval_datasetimages.tar.gzNo
evaluatedataset.val_ann_patheval_datasetannotations.jsonNo
inferenceinference.img_dirinference_datasetimages.tar.gzNo
inferenceinference.ann_pathinference_datasetannotations.jsonNo
traindataset.train_img_dirtrain_datasetsimages.tar.gzNo
traindataset.train_ann_pathtrain_datasetsannotations.jsonNo
traindataset.val_img_direval_datasetimages.tar.gzNo
traindataset.val_ann_patheval_datasetannotations.jsonNo
操作配置键数据源文件是否为列表?
evaluatedataset.val_img_direval_datasetimages.tar.gz
evaluatedataset.val_ann_patheval_datasetannotations.json
inferenceinference.img_dirinference_datasetimages.tar.gz
inferenceinference.ann_pathinference_datasetannotations.json
traindataset.train_img_dirtrain_datasetsimages.tar.gz
traindataset.train_ann_pathtrain_datasetsannotations.json
traindataset.val_img_direval_datasetimages.tar.gz
traindataset.val_ann_patheval_datasetannotations.json

Typical Spec Overrides

典型配置覆盖

Data source overrides are mandatory for every action — the agent MUST construct data source paths from the Per-Action Dataset Requirements table above and include them in
spec_overrides
.
python
S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"
train (mandatory data sources):
python
{
    "train.num_gpus": 1,
    "train.gpu_ids": [
        0
    ],
    "train.num_epochs": 5,
    "train.checkpoint_interval": 5,
    "train.validation_interval": 5,
    "dataset.train_img_dir": f"{S3_TRAIN}/images.tar.gz",
    "dataset.train_ann_path": f"{S3_TRAIN}/annotations.json",
    "dataset.val_img_dir": f"{S3_EVAL}/images.tar.gz",
    "dataset.val_ann_path": f"{S3_EVAL}/annotations.json",
}
evaluate (mandatory data sources):
python
{
    "dataset.val_img_dir": f"{S3_EVAL}/images.tar.gz",
    "dataset.val_ann_path": f"{S3_EVAL}/annotations.json",
}
inference (mandatory data sources):
python
{
    "inference.img_dir": f"{S3_EVAL}/images.tar.gz",
    "inference.ann_path": f"{S3_EVAL}/annotations.json",
}
数据源覆盖对每个操作都是必填项 —— 智能体必须根据上述“各操作的数据集要求”表格构建数据源路径,并将其包含在
spec_overrides
中。
python
S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"
train(必填数据源):
python
{
    "train.num_gpus": 1,
    "train.gpu_ids": [
        0
    ],
    "train.num_epochs": 5,
    "train.checkpoint_interval": 5,
    "train.validation_interval": 5,
    "dataset.train_img_dir": f"{S3_TRAIN}/images.tar.gz",
    "dataset.train_ann_path": f"{S3_TRAIN}/annotations.json",
    "dataset.val_img_dir": f"{S3_EVAL}/images.tar.gz",
    "dataset.val_ann_path": f"{S3_EVAL}/annotations.json",
}
evaluate(必填数据源):
python
{
    "dataset.val_img_dir": f"{S3_EVAL}/images.tar.gz",
    "dataset.val_ann_path": f"{S3_EVAL}/annotations.json",
}
inference(必填数据源):
python
{
    "inference.img_dir": f"{S3_EVAL}/images.tar.gz",
    "inference.ann_path": f"{S3_EVAL}/annotations.json",
}

Eval Dataset

Eval Dataset

Optional. Val images and annotations configured alongside train paths.
可选。验证集图像和标注与训练路径一同配置。

Important Parameters

重要参数

  • model.arch: ViT-MAE backbone variant. Default vit-mae-base/16. Options include vit-mae-large/16 and other ViT-MAE variants.
  • train.lr: Learning rate. Default 1e-6 (very low — fine-tuning ViT).
  • model.crop_size: Training crop size. Default 512.
  • train.warmup_epochs: Warmup epochs before full learning rate.
  • model.load_mask: Whether to load pre-computed masks.
  • model.arch: ViT-MAE骨干网络变体。默认值为vit-mae-base/16。可选值包括vit-mae-large/16及其他ViT-MAE变体。
  • train.lr: 学习率。默认值为1e-6(数值极低,用于ViT微调)。
  • model.crop_size: 训练裁剪尺寸。默认值为512。
  • train.warmup_epochs: 达到全学习率前的预热轮数。
  • model.load_mask: 是否加载预计算掩码。

Multi-GPU / Multi-Node

多GPU / 多节点

Launch method: Lightning-managed (single
python
process, Lightning spawns workers).
Spec KeyDescriptionDefault
train.num_gpus
Number of GPUs1
train.gpu_ids
GPU device indices[0]
train.num_nodes
Number of nodes1
  • Multi-GPU strategy:
    ddp_find_unused_parameters_true
  • No fsdp support
  • LR auto-scaling:
    lr = lr * num_devices * batch_size
    (learning rate is scaled automatically by device count and batch size)
Multi-node env vars (set by orchestrator):
WORLD_SIZE
,
NODE_RANK
,
MASTER_ADDR
,
MASTER_PORT
,
NUM_GPU_PER_NODE
.
启动方式: Lightning管理(单个
python
进程,Lightning生成工作进程)。
配置键描述默认值
train.num_gpus
GPU数量1
train.gpu_ids
GPU设备索引[0]
train.num_nodes
节点数量1
  • 多GPU策略:
    ddp_find_unused_parameters_true
  • 不支持fsdp
  • 学习率自动缩放:
    lr = lr * num_devices * batch_size
    (学习率会根据设备数量和批量大小自动缩放)
多节点环境变量(由编排器设置):
WORLD_SIZE
,
NODE_RANK
,
MASTER_ADDR
,
MASTER_PORT
,
NUM_GPU_PER_NODE

Hardware

硬件要求

Minimum 1 GPU(s), recommended 2 GPU(s). 24GB+ (A100 recommended) VRAM per GPU. ViT-MAE backbone at crop_size=512 needs 24GB+ GPU memory.
最低需要1块GPU,推荐2块GPU。每块GPU需24GB及以上显存(推荐A100)。当crop_size=512时,ViT-MAE骨干网络需要24GB及以上GPU显存。

Error Patterns

错误场景

CUDA out of memory: Reduce model.crop_size (512 -> 384 -> 256) or use a smaller ViT-MAE variant (base vs large).
CUDA内存不足:减小model.crop_size(从512调整为384再到256)或使用更小的ViT-MAE变体(base版替代large版)。

Spec Param / Parent Model Inference

配置参数 / 父模型推理

Model-specific inference mappings belong in this MD file, not in
config.json
. Generated runners should read this section and apply the mappings with SDK helpers before
create_job()
. This mirrors the old microservices
infer_params.py
flow.
Inference mappings from TAO Core
mal.config.json
:
ActionSpec FieldInference FunctionMeaning
evaluate
evaluate.checkpoint
parent_model
model file inferred from the parent job results folder
evaluate
results_dir
output_dir
current job results directory
inference
inference.checkpoint
parent_model
model file inferred from the parent job results folder
inference
inference.label_dump_path
create_inference_result_file_mal
MAL inference JSON path
inference
results_dir
output_dir
current job results directory
train
results_dir
output_dir
current job results directory
For
parent_model
or
parent_model_folder
, pass the upstream train/export/AutoML child job id as
parent_job_id
. The SDK lists the parent result folder, filters checkpoint artifacts, and returns the selected model file or folder. Do not add these mappings back to
config.json
and do not patch generated runner scripts to guess checkpoint paths.
模型特定的推理映射应放在此MD文件中,而非
config.json
。生成的运行器应读取本节内容,并在调用
create_job()
前使用SDK助手应用这些映射。这与旧微服务的
infer_params.py
流程一致。
来自TAO Core
mal.config.json
的推理映射:
操作配置字段推理函数含义
evaluate
evaluate.checkpoint
parent_model
从父任务结果文件夹中推断出模型文件
evaluate
results_dir
output_dir
当前任务结果目录
inference
inference.checkpoint
parent_model
从父任务结果文件夹中推断出模型文件
inference
inference.label_dump_path
create_inference_result_file_mal
MAL推理结果JSON路径
inference
results_dir
output_dir
当前任务结果目录
train
results_dir
output_dir
当前任务结果目录
对于
parent_model
parent_model_folder
,将上游训练/导出/AutoML子任务ID作为
parent_job_id
传入。SDK会列出父任务结果文件夹,过滤检查点工件,并返回选中的模型文件或文件夹。请勿将这些映射添加回
config.json
,也不要修改生成的运行器脚本以猜测检查点路径。