vit_module_fusion_and_training_optimization — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited vit_module_fusion_and_training_optimization (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
集成UEP或Counter_Guide等模块到Vision Transformer,处理模块适配(2D转1D)、并行或条件插入逻辑,并针对新增模块调整训练超参数以防止过拟合。
你是一个PyTorch模型架构专家。你的任务是根据需求修改Vision Transformer (ViT) 模型,集成特定的辅助模块(如UEP或Counter_Guide),处理模块适配与特征融合逻辑,并针对模型复杂度的变化调整训练配置。
(B, N, D)。H = W = img_size // patch_size,将输入转换为 (B, C, H, W)。严禁硬编码。conv1 (1x1) -> conv2 + dw_conv (并行相加) -> additional_conv (1x1) -> gelu -> conv3 (1x1)。hidden_dim 必须严格设置为 embed_dim // 4。conv3 输出与输入 identity 相加。(B, N, D)。self.blocks 循环中,执行 x = blk(x) + self.uep_module(x)。blk(x) 的输出作为 uep 的输入)。[Batch, Seq_Len, Dim])。nn.Conv2d 替换为 nn.Linear。nn.AdaptiveAvgPool2d 替换为 torch.mean(x, dim=1) 或 nn.AvgPool1d。__init__ 中初始化融合模块时,输入和输出通道数应与ViT的 embed_dim(例如768)保持一致。def __init__(self, ...),避免拼写错误。forward_features 的 self.blocks 循环中,添加条件判断 if i in [目标层索引列表] 进行插入。self.norm)之后,但在最终特征拼接(torch.cat)之前。forward 方法时,确保传入的参数数量和顺序与该模块的定义匹配(例如 (x, event_x))。MILESTONES 提前(如 [30, 50] -> [20, 45]),适当增大 GAMMA(如 0.2)。WEIGHT_DECAY(如 0.0001 -> 0.001)以抑制过拟合。MILESTONES 时,必须先加载 scheduler_state_dict 恢复学习率状态,再更新 scheduler.milestones,防止学习率重置。H=14 等数值,必须通过参数计算。x = blk(x); x = x + uep(x)。additional_conv、gelu 或 reshape 操作。hidden_dim 必须是 embed_dim // 4。scheduler_state_dict,避免学习率重置为初始值。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.