Skip to content

Add Llama4 text model - #4536

Merged
WYB27 merged 36 commits into
PaddlePaddle:developfrom
yicycyc:feat/llama4-migration
Oct 13, 2026
Merged

WYB27 merged 36 commits into
PaddlePaddle:developfrom
yicycyc:feat/llama4-migration

Conversation

@yicycyc

@yicycyc yicycyc commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Llama4\Llama-Guard-4 PR&复现对齐报告

本PR完成了Llama4\Llama-Guard-4模型在PaddleFormers上的实现,并在缩层参数下完成了精度验证。

#Llama4部分

一、前向对齐(Logits Alignment)

输入:

[[1, 5, 17, 23, 42, 77, 101, 3],
 [9, 8, 7, 6, 5, 4, 3, 2]]

结果:

dtype shape torch output dtype Paddle output dtype max_abs mean_abs rms allclose
fp32 [2, 8, 202048] torch.float32 paddle.float32 2.2888183594e-05 6.9714536721e-07 1.5060829810e-06 true
bf16 [2, 8, 202048] torch.bfloat16 paddle.bfloat16 0.0 0.0 0.0 true

二、训练对齐

训练实验使用 1-layer 缩层模型。原因是它可以稳定训练,同时仍保留 Llama4 的 MoE/feed-forward 关键路径。

设置:

  • Paddle:PaddleFormers stage3,4 卡
  • Torch:ms-swift + DeepSpeed ZeRO3,4 卡
  • max sequence length:512
  • max steps:300
  • per-device train batch size:1
  • gradient accumulation:1
  • learning rate:1e-5
  • scheduler:constant
  • warmup:0
  • weight decay:0
  • grad clip:关闭
  • shuffle:关闭
  • 精度:bf16
  • attention:eager

关键 step loss:

step Paddle loss Torch ZeRO3 loss Paddle - Torch
1 20.7799301100 20.7856235504 -0.0056934404
2 21.8704490700 21.8677368164 0.0027122536
10 17.8161048900 17.8202648163 -0.0041599263
20 16.5163822200 16.5203647614 -0.0039825414
100 8.9483223000 8.9469490051 0.0013732949
200 5.3667316400 5.3645229340 0.0022087060
300 5.2806272500 5.2780942917 0.0025329583

训练汇总:

metric value
common steps 300
Paddle train_loss 8.2646931060
Torch train_loss 8.2633150991
mean(Paddle - Torch) 0.0013780069
mean(abs diff) 0.0022063081
max(abs diff) 0.0077619549

Loss曲线&Loss diff 曲线:
llama4_1layer_paddle_aligned300_vs_torch_zero3_300_loss
llama4_1layer_paddle_aligned300_vs_torch_zero3_300_loss_diff

三、生成对齐

使用相同输入:

Question: What is 2 + 3?\nAnswer:

两侧前十个token相同,
paddle输出:

Centiliter aver・輸送の送料Nur 한명은้ามากร मुताब・

transformers输出:

Centiliter aver・輸送の送料Nur 한명은้ามากร मुताब・

#Llama-Guard-4部分

Description

PR 新增模型支持:Llama Guard 4

本 PR 新增 meta-llama/Llama-Guard-4-12B 支持。Llama Guard 4 使用 Llama4 多模态架构,本次补齐其视觉编码、图文特征融合、条件生成和原始 HuggingFace checkpoint 加载能力。

主要改动

  • 新增 Llama Guard 4 多模态模型组件:
    • vision encoder
    • pixel shuffle adapter
    • multimodal projector
    • Llama4ForConditionalGeneration
    • 图像 token 展开与图文特征融合
  • 新增 Llama Guard 4 原始 checkpoint 加载映射:
    • text backbone 权重
    • vision encoder 权重
    • multimodal projector 权重
    • 支持直接加载原始 HuggingFace safetensors,无需离线转换
  • 补充 AutoConfig 和条件生成模型注册
  • 修复 attention_chunk_size=None 时的 full-attention mask 和 generation cache 路径
  • 新增 Llama Guard 4 多模态单测,覆盖:
    • vision forward
    • multimodal forward/loss
    • image token 数量校验
    • deterministic forward
    • 无 attention chunk 的 greedy generation

验证模型

验收使用保持原始宽度的缩层 Llama Guard 4 checkpoint:

  • text layer:1/48
  • vision layer:1/34
  • vocab、hidden size、attention heads、vision width 和 projector width 均保持原始配置
  • 参数量:2.344B
  • 单张 NVIDIA A100 40GB
  • FP32
  • attention backend:eager

前向对齐验证

Transformers 与 PaddleFormers 加载相同缩层权重和相同输入。

对齐项 max abs diff 结论
纯文本 logits 1.05e-5 对齐
多模态 logits 1.95e-4 对齐
vision hidden states 7.15e-6 对齐

纯文本、多模态和视觉编码输出均满足 1e-2 前向精度标准。

生成对齐

使用相同权重和输入进行 greedy generation,关闭采样,两侧前 10 个新 token 完全一致。

结论:前 10 个 token 匹配率为 10/10,生成对齐通过。

训练验证

PaddleFormers 与 ms-swift 使用相同的预处理结果和样本顺序,在相同缩层 Llama Guard 4 checkpoint 上完成单卡 FP32 full-parameter SFT。

共同设置:

  • 单张 NVIDIA A100 40GB
  • max_steps = 300
  • per_device_train_batch_size = 1
  • gradient_accumulation_steps = 1
  • learning_rate = 1e-5
  • lr_scheduler_type = constant
  • warmup_steps = 0
  • weight_decay = 0
  • gradient clipping:global norm 1.0
  • seed = 42
  • shuffle 关闭
  • attention eager
  • full-parameter SFT

1、纯文本

使用 GSM8K 300 条固定样本做 300-step full-SFT。

指标 ms-swift PaddleFormers Paddle - ms-swift
final loss 3.40126252 3.40126133 -1.19e-6
300-step mean loss 6.61397274 6.61397293 +1.96e-7
last 50 mean loss 3.37818225 3.37818181 -4.41e-7
mean absolute diff — — 1.50e-6
loss correlation — — 0.99999999999995
gsm_loss_comparison

2、多模态

使用 PaddleFormers 多模态 SFT 数据格式准备 300 条固定图文样本,两侧使用完全相同的 token、label、图像张量和样本顺序。

指标 ms-swift PaddleFormers Paddle - ms-swift
final loss 0.67311287 0.67311609 +3.22e-6
300-step mean loss 1.64422996 1.64423101 +1.04e-6
last 50 mean loss 0.52400973 0.52400985 +1.15e-7
mean absolute diff — — 1.99e-6
loss correlation — — 0.99999999999958
loss_comparison

纯文本和多模态训练均跑满 300 step,两侧原始 loss 曲线几乎完全重合。

@paddle-bot

paddle-bot Bot commented May 26, 2026

Copy link
Copy Markdown

Thanks for your contribution!

@yicycyc

yicycyc commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@yicycyc

yicycyc commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

/re-run

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已完成初次审查。当前有几处需要先修复的问题,主要集中在 Llama4 的 MoE 专家初始化、chunked cache mask 和 AutoModel 注册路径;具体细节已放在行内评论。修复后建议补充覆盖长上下文 cache 生成和 AutoModel 加载的最小测试。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment thread paddleformers/transformers/llama4/modeling.py
Comment thread paddleformers/transformers/llama4/modeling.py
Comment thread paddleformers/transformers/auto/configuration.py Outdated

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查,前面几处修复看起来都已到位,但我又补了一条新的阻塞问题,细节在行内评论里。当前还不能合入。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment thread paddleformers/transformers/llama4/modeling.py Outdated
@Paddle-CI-Bot

Paddle-CI-Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

PaddleFormers Log Analysis

Run #33039010633 · Attempt 1

日志分析报告

流水线名称 问题标签 修复建议 日志片段
Unittest GPU CI (job 98400000590) 视频下载失败 paddlenlp.bj.bcebos.com 返回 HTTP 200 但 body 传输中断(0 bytes received),导致 test_video* 相关 case setup 失败,属于网络抖动,rerun 验证 报错代码
Unittest GPU CI (upload-coverage, job 98403558148) 覆盖率上传失败 coverage.xml 下载失败(wget exit code 8),属于 BOS 上传阶段问题,不影响测试本身,rerun 报错代码
Model Unittest GPU CI (job 98399725574) tar 解压失败/git 仓库状态异常 PaddleFormers.tar 解压出错,后续 git checkout develop 返回 exit 128(not a git repository),测试被标为 skipped,rerun 报错代码
Fleet Model Test - single-card (job 98400077460) git clone 网络中断 git clone 到 50% 时 HTTP/2 stream CANCEL,exit 128,与本PR无关,rerun 报错代码
Fleet Model Test - multi-card (job 98400077469) GLM-4.5-Air-Base 模型未缓存 AutoConfig.from_pretrained 找不到 /home/.cache/zai-org/GLM-4.5-Air-Base/config.json,glm45_dpo_lora 训练失败;其余测试(qwen3vl-moe、qwen3vl-fsdp)均通过 报错代码
Fleet Model Test - A100 (job 98400077541) 全部通过 ✅ qwen3vl-moe SFT A100 loss check 通过(Log Loss == GT Loss = 12.3315258) -

失败的测试 case:

# Unittest GPU CI (job 98400000590)
tests/transformers/ernie4_5_moe_vl/test_processor.py::Ernie4_5_VLProcessorTest::test_apply_chat_template_video_frame_sampling
tests/transformers/ernie4_5_moe_vl/test_vision_process.py::Ernie4_5_VLVisionProcessTest::test_video
tests/transformers/glm4v_moe/test_processor.py::Glm4vMoeProcessorTest::test_apply_chat_template_video_frame_sampling
tests/transformers/glm4v_moe/test_modeling.py::Glm4vMoeIntegrationTest::test_inference_no_attention  (setup error: video download)
tests/transformers/glm4v_moe/test_modeling.py::Glm4vMoeIntegrationTest::test_inference_with_attention (setup error: video download)
tests/transformers/kimi_k25/test_processor.py::KimiK25ProcessorTest::test_video_frame_sampling
tests/transformers/qwen2_5_vl/test_modeling.py::Qwen2_5_VLIntegrationTest::test_model_tiny_logits_with_video
tests/transformers/qwen2_5_vl/test_processor.py::Qwen2_5_VLProcessorTest::test_apply_chat_template_video_frame_sampling

# Fleet Model Test - multi-card (job 98400077469)
glm45_dpo_lora: FileNotFoundError /home/.cache/zai-org/GLM-4.5-Air-Base/config.json

根本原因分析:

  • Unittest GPU CI video 相关 case 失败:paddlenlp.bj.bcebos.com 在下载 example_video.mp4(17MB)时连接被服务端提前关闭(received 0 bytes, expected 17417367),为网络侧问题,与 PR 修改内容无关;本 PR 新增了 glm4v_moe/test_modeling.py 等 case,但失败根因是 BOS 视频资源传输中断。
  • Fleet Model Test single-card:git clone 时 HTTP/2 stream CANCEL,与 PR 无关,机器网络抖动。
  • Fleet Model Test multi-card glm45_dpo_lora:runner 上 /home/.cache/zai-org/GLM-4.5-Air-Base 模型文件未缓存,AutoConfig.from_pretrained 直接抛出 FileNotFoundError,本 PR 新增了 GLM-4.5 相关集成测试,但 runner 缓存未准备就绪。
  • Model Unittest GPU CI:PaddleFormers.tar 解压失败导致 git 仓库状态异常,为环境问题。

修复建议:

  1. Unittest GPU CI(video 相关 case):直接 rerun,确认是否稳定复现;若持续失败,将 example_video.mp4 下载加重试逻辑(httpx 客户端配置 retries),或在 setup 阶段 mock 视频 URL 为本地小文件。
  2. Fleet Model Test multi-card(glm45_dpo_lora):在 runner 节点预先缓存 zai-org/GLM-4.5-Air-Base 模型权重到 /home/.cache/zai-org/GLM-4.5-Air-Base/,或在 CI 脚本中加 paddleformers-cli download zai-org/GLM-4.5-Air-Base 预下载步骤。
  3. Model Unittest GPU CI / Fleet single-card:均为网络/环境抖动,直接 rerun。

🔍 准确性记录:请点击评论底部 😊 图标,选择 👍(准确)或 👎(有误),将自动记录到 CI 监控系统

🔄 每次 Re-run 后自动更新

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查当前提交,之前几处 Llama4 相关问题都已修复,当前未发现新的阻塞合入问题。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同步 develop 后已复查,之前 Llama4 相关问题仍保持修复,当前未发现新的阻塞合入问题。CI 仍在运行中,请以后续结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查最新提交,之前的 Llama4 专家初始化、chunked mask、AutoModel 映射以及 attention_mask 保留问题在当前 head 都仍保持修复;本次新增的模板、tool utils 和 LoRA target 逻辑未发现新的代码层阻塞问题。本轮没有新增行内评论。

当前 Lint check 仍失败,日志显示 black/isort 会改写 paddleformers/datasets/template/tool_utils.py、paddleformers/datasets/template/template.py、tests/ai_edited_test/datasets/test_ai_template.py。请先按 CI 运行格式化并重新推送,再以最新 CI 结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

@risemeup1111 risemeup1111 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已复查最新提交:本次只包含 pre-commit 格式化调整,上一轮提到的 Lint 失败已在当前检查中通过。之前的 Llama4 专家初始化、chunked mask、AutoModel 映射以及 attention_mask 保留问题也仍保持修复。

当前未发现需要阻塞合入的问题;其余 CI 仍在运行中,请以后续结果为准。

Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment thread paddleformers/transformers/auto/modeling.py
Comment thread paddleformers/transformers/auto/configuration.py Outdated
Comment thread paddleformers/transformers/llama4/multimodal.py
Comment thread paddleformers/transformers/auto/modeling.py Outdated
Comment thread paddleformers/transformers/llama4/multimodal.py
Comment thread paddleformers/transformers/llama4/modeling.py
Comment thread paddleformers/transformers/llama4/modeling.py
Comment thread paddleformers/transformers/auto/configuration.py Outdated
Comment thread paddleformers/transformers/auto/modeling.py
Comment thread paddleformers/transformers/auto/configuration.py Outdated
Comment thread paddleformers/transformers/llama4/multimodal.py


@dataclass
class Llama4Plugin(BasePlugin):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

纯文本和带图都会用到这个plugin,纯文数据在_validate_input的判断里面会因为没有image processor而raise(136-137L)
建议纯文和多模拆成两个模版名,参考qwen3/qwen3_vl,glm4_moe/glm4v等

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 37661f1 修复并推送。拆分为 llama4(纯文本 BasePlugin)和 llama4_vl(图文 Llama4Plugin),保留相同对话格式;纯文本不再要求 image processor。新增无 processor 的文本模板回归测试,README 中 Guard4 模板同步改为 llama4_vl。图文配置需使用新模板名。Llama4 整组测试 51 passed、5 skipped,pre-commit 通过。

|Qwen2|✓|✓|✓|✓|✓|
|Qwen3|✓|✓|✓|✓|✓|
|Qwen3-Next|✓|✓|✓|✓|✓|
|Llama Guard 4|x|✓|✓|x|x|

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Llama Guard 4 的lora没注册

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 37661f1 补齐并推送。CLI 默认 LoRA target 注册加入多模态 model_type=llama4,复用 Llama4 文本投影目标,并新增注册回归测试。同步检查 FastVLM、LFM2-VL、DeepSeek-OCR2、Phi-4、Mistral3 的对应注册,均已有分支。Llama4 整组测试 51 passed、5 skipped;本轮未重跑完整 LoRA 训练。

class Llama4TextModel(Llama4TextPretrainedModel):
def __init__(self, config: Llama4TextConfig):
super().__init__(config)
if config.attention_chunk_size is not None and config._attn_implementation != "eager":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attention_chunk_size在CLI有默认非空配置,建议再额外校验一下chunked_attention 是否在 layer_types里面

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 37661f1 修复并推送。只有 attention_chunk_size 非空且 layer_types 包含 chunked_attention 时才限制 eager;mask 构建也增加同样条件。补充 full_attention + 非空 chunk size + flashmask 的模型构造测试,原 chunked 非 eager 拒绝测试保留。Llama4 整组测试 51 passed、5 skipped;此构造测试不代表完整 flashmask 数值验收。

@dataclass
class Llama4Plugin(BasePlugin):
masked_tokens: Optional[list[str]] = None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里沿用了基类 image_max_pixels 预缩放,但是llama4不是动态分辨率不需要这步吧?HF上也没有这步,实测1200×900出的tile数量不一致。建议覆写 _get_mm_inputs,绕过 _preprocess_image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 37661f1 修复并推送。覆写 Llama4Plugin._get_mm_inputs,只读取图像、转换 RGB、按 imglens 分组,绕过基类像素预算预缩放,由 Llama4ImageProcessor 根据原图尺寸选择 tiles。新增 1200×900 图像回归测试,确认 plugin 与直接 image processor 的 aspect_ratios、pixel_values 完全一致。Llama4 整组测试 51 passed、5 skipped,pre-commit 通过。

@risemeup1111

risemeup1111 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

WYB27
WYB27 previously approved these changes Sep 22, 2026

@WYB27 WYB27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WYB27

WYB27 commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

辛苦解一下冲突

@WYB27

WYB27 commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

辛苦解一下冲突

@WYB27

WYB27 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

辛苦解一下其他模型合入带来的冲突

WYB27
WYB27 previously approved these changes Oct 13, 2026

@WYB27 WYB27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WYB27

WYB27 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

辛苦解一下代码风格问题

if imglens is not None:
images = _make_batched_images(images, imglens)
return processor.image_processor(images, return_tensors="pd")
class MolmoPlugin(BasePlugin):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 本次合并的冲突处理把 Llama4Plugin 与新引入的 MolmoPlugin 交错,导致两者都被破坏:

  • Llama4Plugin(1490-1503)现在只剩 _get_mm_inputs,丢失了原本的 process_messages(按 aspect_ratios 调用 _prompt_split_image/_num_patches_per_chunk 展开图像 tile 占位符的逻辑)。实测 Llama4Plugin.process_messages is BasePlugin.process_messages 为 True,即已回退到基类实现,llama4_vl 多模态不再展开 IMAGE_PLACEHOLDER,图像 token 数与 pixel_values 不再匹配,破坏本 PR 的 Llama Guard 4 图文 SFT/前向。
  • MolmoPlugin(1504 起)缺少 @dataclass,且其 process_messages 把 Llama4 的 aspect_ratios 校验(“Llama 4 requires one aspect ratio for each input image”)与 _prompt_split_image/_num_patches_per_chunk 和 Molmo 自身的 User: token 逻辑拼接在一起,Molmo 输入会误入 Llama4 分支并抛错。

建议按合并前结构恢复:Llama4Plugin 保留自身的 process_messages;MolmoPlugin 恢复为 develop 侧的独立类(含 @dataclass 及仅属于 Molmo 的 process_messages),不要相互混入。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新提交 9eb4c1d(“separate Llama4 and Molmo plugin classes”)仅在两个类之间插入了两行空行,并未修复逻辑交错,P0 仍然存在:

  1. Llama4Plugin 丢失了自己的 process_messages,只剩 _get_mm_inputs,于是回退到 BasePlugin.process_messages(不展开图像占位符)——Llama4 图像 token 不会被展开,多模态推理会错位。
  2. MolmoPlugin 缺少 @dataclass 装饰器(与其它所有插件不一致),且其 process_messages 开头仍是 Llama4 的 aspect_ratios 校验(raise ValueError("Llama 4 requires one aspect ratio for each input image."))、_prompt_split_image、_num_patches_per_chunk 逻辑,之后才接 Molmo 的 User: token 逻辑(中间还有多余的第二次 messages = deepcopy(messages))。Molmo 路径会先命中 Llama4 的校验而报错。

需要真正拆分:把 Llama4 的 process_messages(aspect_ratios 展开)归还给 Llama4Plugin,MolmoPlugin 仅保留 Molmo 自己的 User: 逻辑并补回 @dataclass。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新提交 cc08161 已修复该 P0:

  1. Llama4Plugin 重新拥有自己的 process_messages(aspect_ratios 校验 + _prompt_split_image / _num_patches_per_chunk 图像展开),不再回退到 BasePlugin 空实现。
  2. MolmoPlugin 补回 @dataclass,其 process_messages 已剔除 Llama4 的 aspect_ratios 逻辑与多余的重复 deepcopy,仅保留 Molmo 自身的 User: token 处理。
  3. 新增单测 test_image_plugins_keep_independent_message_handlers、test_molmo_image_messages_do_not_require_llama4_aspect_ratios、test_molmo_text_messages_keep_user_prefix 直接覆盖了两个插件处理器相互独立、Molmo 不再触发 Llama4 校验的回归点。

逻辑交错已正确拆分,标记为已解决。



@dataclass
class Llama4Plugin(BasePlugin):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Llama4Plugin和MolmoPlugin互相冲突有问题,需要解决。
直接跑测试用例tests/transformers/llama4/test_processor.py也能发现同一个问题,辛苦确保后续commit自测通过测试用例后再提交

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 cc08161 修复并完成自测后推送。上一次仅修格式,没有核查合并后的类结构,确实漏掉了逻辑错误,抱歉。

本次将 aspect_ratios / tile 占位符展开的 process_messages 恢复到 Llama4Plugin;MolmoPlugin 恢复独立 @DataClass 和 Molmo 自身的 User 前缀逻辑。AST 核对:Llama4Plugin 与合并前一致,MolmoPlugin 与当前 develop 一致。

新增3项回归,连同现有 placeholder 展开测试做修复前后对照:旧代码4项失败,修复后4项通过。最终复跑 tests/transformers/llama4、tests/transformers/molmo、共享 template/tool_utils 测试:145 passed、9 skipped、4 subtests passed;包含您指出的 test_processor.py。AutoModel 架构优先级另行验证通过。PR全部Python文件 pre-commit通过。

9个skip属于既有未实现/不适用测试及缺少torch的跨框架测试,未宣称执行。未修改模型计算公式;当前develop已包含,无Git合并冲突。

@WYB27 WYB27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WYB27
WYB27 merged commit f7fa77f into PaddlePaddle:develop Oct 13, 2026
13 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants