Skip to content

[TeleChat]: add TeleChat causal language model support - #4768

Open
cf-icehzgzh wants to merge 4 commits into
PaddlePaddle:developfrom
cf-icehzgzh:feat/add-telechat-model
Open

[TeleChat]: add TeleChat causal language model support#4768
cf-icehzgzh wants to merge 4 commits into
PaddlePaddle:developfrom
cf-icehzgzh:feat/add-telechat-model

Conversation

@cf-icehzgzh

Copy link
Copy Markdown
Contributor

本 PR 完成 Tele-AI/TeleChat-1B 从 Transformers 到 PaddleFormers 的迁移,包含组网、权重转换、前向精度、生成、LoRA 训练 loss 对齐、LoRA 合并及单测验证。

1. 前向精度对齐

  • 模型:Tele-AI/TeleChat-1B

  • 通过官方 PyTorch 权重转换为 PaddleFormers 权重进行验证

  • AutoConfigAutoModelAutoModelForCausalLM 本地加载验证通过

  • PaddleFormers / Transformers logits:

    • mean abs diff:1.5991124655556632e-06
    • max abs diff:2.6702880859375e-05
    • argmax:完全一致

2. 模型生成

相同转换权重与 greedy 解码下验证通过,连续生成 8 个 token 与官方 PyTorch 实现逐 token 完全一致。

  • Prompt:<_user>你好<_bot>
  • PaddleFormers generated token ids:
[20, 20, 20, 20, 20, 20, 20, 20]

3. 训练 loss 对齐

  • 模型:Tele-AI/TeleChat-1B
  • LoRA:rank=8,alpha=16,dropout=0
  • 目标层:querykey_valuedensegate_projup_projdown_proj
  • 使用相同输入、causal labels、固定 LoRA 权重进行 FP32 loss 对齐
  • 注入 LoRA 线性层数:PyTorch / PaddleFormers 均为 96

首步 loss:

  • PyTorch:25.866153717041016
  • PaddleFormers:25.86615562438965
  • absolute difference:1.9073486328125e-06

logits checksum:476130.65625,两端完全一致;所有位置 argmax 完全一致。

4. LoRA 训练、合并与确定性

  • 单卡 FP16 LoRA SFT 训练跑通
  • LoRA adapter 保存成功
  • 使用 get_merge_state_dict 导出纯合并权重:
    • base checkpoint keys:163
    • lora_A / lora_B 残留
    • 合并模型重新加载、前向和 greedy generation 验证通过
  • 相同 seed、相同数据与顺序、相同配置连续运行两次 3-step LoRA 训练:
    • losses:[10.734102249145508, 8.075804710388184, 3.176398754119873]
    • adapter tensors:192
    • 两次最终 adapter SHA-256 完全一致:
      eaf30ec683e4d5fe75a9c9fc3c9bf4f6a274cc1964d6c03089ff50f2bfbba45e

5. 模型单测

覆盖:

  • 前向输出 shape 与 AutoConfig 注册
  • causal loss、loss_mask 与空监督 mask
  • AutoModel / AutoModelForCausalLM 路由
  • TeleChat 默认 LoRA target modules
  • KV cache decode 与 full forward 一致性
  • greedy generation
pytest tests/transformers/telechat/test_modeling.py -q
6 passed

git diff --check 已通过。

不包含转换权重、训练配置、训练 checkpoint、LoRA adapter、合并模型或本地验证脚本。

@CLAassistant

CLAassistant commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cf-icehzgzh
cf-icehzgzh force-pushed the feat/add-telechat-model branch from d6cd78c to 2e4da63 Compare July 14, 2026 12:16

@liuhao2638 liuhao2638 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.

已完成初审,发现了需要修复后再合入的问题,具体细节已放在行级评论中。CI 当前显示通过;本地环境缺少 paddle,我未能复跑新增模型单测。

  • P3 优先级:P3 非行级:PR 标题和描述目前只说明 TeleChat,但 diff 同时新增并公开导出 DiffTransformer 模型、tokenizer 和测试,范围与描述不一致。处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。 建议将 DiffTransformer 相关变更拆到独立 PR,或在本 PR 标题/描述/测试计划中明确说明这部分范围和验证结果。
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

[
("deepseek_v2", "DeepseekV2"),
("deepseek_v3", "DeepseekV3"),
("diff_transformer", "DiffTransformer"),

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.

P1 优先级:P1
处理要求:请针对该评论修复并提交新的 commit。

这里把 diff_transformer 的基础模型名注册成了 DiffTransformer,但新增的 paddleformers.transformers.diff_transformer 只导出了 DiffTransformerModel / DiffTransformerForCausalLM,没有 DiffTransformer 这个符号。AutoModel.from_config(DiffTransformerConfig())_LazyAutoMapping 时会按这个名字加载属性,导致新注册的 AutoModel 路由不可用。请把映射改成实际导出的基础模型类,或补充等价别名并加上 AutoModel 路由测试。

Suggested change
("diff_transformer", "DiffTransformer"),
("diff_transformer", "DiffTransformerModel"),

Comment on lines +79 to +82
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * self.num_heads != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")

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.

P1 优先级:P1
处理要求:请针对该评论修复并提交新的 commit。

query / key_value 使用 GeneralLinear.create(..., tp_plan="colwise") 后,在 tensor_model_parallel_size > 1 时每个 rank 只会拿到分片后的 hidden 维度;但这里的 self.num_heads 仍是全局 config.n_head,下面 reshape 到 [batch, seq, self.num_heads, self.head_dim] 会直接形状不匹配。其它 LLM 实现会先把本地 head 数除以 TP degree。请按本地 head 数 reshape,并补充一个 tensor_model_parallel_size > 1 的构造/前向覆盖。

Suggested change
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * self.num_heads != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * config.n_head != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")
if config.tensor_model_parallel_size > 1:
if config.n_head % config.tensor_model_parallel_size != 0:
raise ValueError("n_head must be divisible by tensor_model_parallel_size")
self.num_heads = config.n_head // config.tensor_model_parallel_size

def __init__(self, config):
super().__init__(config)
self.transformer = TelechatModel(config)
self.lm_head = GeneralLinear.create(config.hidden_size, config.vocab_size, has_bias=False, config=config, tp_plan="colwise")

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.

P1 优先级:P1
处理要求:请针对该评论修复并提交新的 commit。

这里同样走了 colwise TP,但默认 gather_output=False 会让 logits 只包含本 rank 的 vocab_size / tensor_model_parallel_size 分片。后面的 F.log_softmaxtake_along_axis 以及 generation 都按完整词表使用 logits.shape[-1],TP 下会得到错误 loss/采样分布,甚至 labels 超出本地分片时索引失败。请确保 causal LM 输出完整词表 logits,或改用仓库里已有的 GeneralLMHead/分布式 criterion 路径并同步调整权重转换。

Suggested change
self.lm_head = GeneralLinear.create(config.hidden_size, config.vocab_size, has_bias=False, config=config, tp_plan="colwise")
self.lm_head = GeneralLinear.create(
config.hidden_size,
config.vocab_size,
has_bias=False,
config=config,
tp_plan="colwise",
gather_output=True,
)

def forward(self, x, position_ids):
freqs = position_ids.astype("float32").unsqueeze(-1) * self.inv_freq.reshape([1, 1, -1])
emb = paddle.concat((freqs, freqs), axis=-1)
return emb.cos().astype("float16"), emb.sin().astype("float16")

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.

P2 优先级:P2
处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。

这里把 RoPE 的 cos/sin 固定成 float16,会让 FP32 前向/精度对齐路径也先经过半精度位置编码;如果用户用 BF16,位置编码还会先量化到 FP16 再参与计算。仓库里同类 RoPE 通常按输入 hidden states 的 dtype 返回,请避免在这里硬编码为 FP16。

Suggested change
return emb.cos().astype("float16"), emb.sin().astype("float16")
return emb.cos().astype(x.dtype), emb.sin().astype(x.dtype)

@cf-icehzgzh
cf-icehzgzh force-pushed the feat/add-telechat-model branch 2 times, most recently from 4dfb614 to bdaf729 Compare July 14, 2026 15:12

@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.

复查当前 head 后,之前的 DiffTransformer 范围已不在当前 PR diff 中;CI 显示通过。本地环境缺少 paddle,未能复跑新增 TeleChat 单测。

仍有需要修复后再合入的 TeleChat TP 路径问题,细节见行级评论。

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

Comment on lines +79 to +82
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * self.num_heads != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")

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.

P1 优先级:P1
处理要求:请针对该评论修复并提交新的 commit。

query / key_value 使用 tp_plan="colwise" 后,在 tensor_model_parallel_size > 1 时每个 rank 只会拿到分片后的 hidden 维度;但这里仍用全局 config.n_head 做 reshape,self.query(hidden_states) 的最后一维会是 hidden_size / tp_size,无法 reshape 到 config.n_head * head_dim == hidden_size。请按本地 head 数 reshape,并补充一个 tensor_model_parallel_size > 1 的构造或前向覆盖。

Suggested change
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * self.num_heads != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")
self.num_heads = config.n_head
self.head_dim = config.hidden_size // config.n_head
if self.head_dim * config.n_head != config.hidden_size:
raise ValueError("hidden_size must be divisible by n_head")
if config.tensor_model_parallel_size > 1:
if config.n_head % config.tensor_model_parallel_size != 0:
raise ValueError("n_head must be divisible by tensor_model_parallel_size")
self.num_heads = config.n_head // config.tensor_model_parallel_size

def __init__(self, config):
super().__init__(config)
self.transformer = TelechatModel(config)
self.lm_head = GeneralLinear.create(config.hidden_size, config.vocab_size, has_bias=False, config=config, tp_plan="colwise")

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.

P1 优先级:P1
处理要求:请针对该评论修复并提交新的 commit。

lm_head 同样走 colwise TP,但默认不会聚合输出,TP 下 logits 只包含本 rank 的词表分片。后面的 F.log_softmaxtake_along_axis 和 generation 都按完整词表使用 logits;一旦 label 落在其它 rank 的词表分片上会索引失败,采样分布也会错误。请确保 causal LM 输出完整词表 logits,或改为仓库已有的分布式 loss/generation 路径并同步补测试。

Suggested change
self.lm_head = GeneralLinear.create(config.hidden_size, config.vocab_size, has_bias=False, config=config, tp_plan="colwise")
self.lm_head = GeneralLinear.create(
config.hidden_size,
config.vocab_size,
has_bias=False,
config=config,
tp_plan="colwise",
gather_output=True,
)

def forward(self, x, position_ids):
freqs = position_ids.astype("float32").unsqueeze(-1) * self.inv_freq.reshape([1, 1, -1])
emb = paddle.concat((freqs, freqs), axis=-1)
return emb.cos().astype("float16"), emb.sin().astype("float16")

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.

P2 优先级:P2
处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。

这里把 RoPE 的 cos/sin 固定成 float16,会让 FP32 前向也先经过半精度位置编码;BF16 路径还会先量化到 FP16 再参与计算。仓库同类 RoPE 通常按输入 hidden states 的 dtype 返回,请避免在这里硬编码为 FP16。

Suggested change
return emb.cos().astype("float16"), emb.sin().astype("float16")
return emb.cos().astype(x.dtype), emb.sin().astype(x.dtype)

@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.

已复查新 commit。两个此前阻塞的 TP 路径问题已通过代码修改和新增测试覆盖修复;RoPE dtype 也已改为按输入 dtype 返回。CI 当前显示通过;本地环境仍缺少 paddle,未能复跑新增单测。

当前没有新的行级问题。按评审约定,剩余的低优先级线程还需要作者在对应评论下回复 Done 或说明理由后,我再提交批准。

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

@cf-icehzgzh

Copy link
Copy Markdown
Contributor Author

已完成初审,发现了需要修复后再合入的问题,具体细节已放在行级评论中。CI 当前显示通过;本地环境缺少 paddle,我未能复跑新增模型单测。

  • P3 优先级:P3 非行级:PR 标题和描述目前只说明 TeleChat,但 diff 同时新增并公开导出 DiffTransformer 模型、tokenizer 和测试,范围与描述不一致。处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。 建议将 DiffTransformer 相关变更拆到独立 PR,或在本 PR 标题/描述/测试计划中明确说明这部分范围和验证结果。

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

Done

3 similar comments
@cf-icehzgzh

Copy link
Copy Markdown
Contributor Author

已完成初审,发现了需要修复后再合入的问题,具体细节已放在行级评论中。CI 当前显示通过;本地环境缺少 paddle,我未能复跑新增模型单测。

  • P3 优先级:P3 非行级:PR 标题和描述目前只说明 TeleChat,但 diff 同时新增并公开导出 DiffTransformer 模型、tokenizer 和测试,范围与描述不一致。处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。 建议将 DiffTransformer 相关变更拆到独立 PR,或在本 PR 标题/描述/测试计划中明确说明这部分范围和验证结果。

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

Done

@cf-icehzgzh

cf-icehzgzh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

已完成初审,发现了需要修复后再合入的问题,具体细节已放在行级评论中。CI 当前显示通过;本地环境缺少 paddle,我未能复跑新增模型单测。

  • P3 优先级:P3 非行级:PR 标题和描述目前只说明 TeleChat,但 diff 同时新增并公开导出 DiffTransformer 模型、tokenizer 和测试,范围与描述不一致。处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。 建议将 DiffTransformer 相关变更拆到独立 PR,或在本 PR 标题/描述/测试计划中明确说明这部分范围和验证结果。

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

Done

@cf-icehzgzh

Copy link
Copy Markdown
Contributor Author

已完成初审,发现了需要修复后再合入的问题,具体细节已放在行级评论中。CI 当前显示通过;本地环境缺少 paddle,我未能复跑新增模型单测。

  • P3 优先级:P3 非行级:PR 标题和描述目前只说明 TeleChat,但 diff 同时新增并公开导出 DiffTransformer 模型、tokenizer 和测试,范围与描述不一致。处理要求:请针对该评论进行回复(同意并已修改请回复 Done,不同意请说明理由)。 建议将 DiffTransformer 相关变更拆到独立 PR,或在本 PR 标题/描述/测试计划中明确说明这部分范围和验证结果。

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

Done

@paddle-bot

paddle-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Thanks for your contribution!

@cf-icehzgzh
cf-icehzgzh force-pushed the feat/add-telechat-model branch from a184700 to ed18579 Compare July 18, 2026 16:53

@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.

复查当前 head,代码树相对上次复查没有变化;此前 TeleChat TP 和 RoPE dtype 的代码修复仍然在。新的阻塞点是当前 CI 的 Lint 失败,能定位到具体行的部分已放在行级评论中。

  • P0 优先级:P0 非行级:CI Lintblack 还报告会重写 paddleformers/transformers/telechat/modeling.py,这部分格式化结果通常是多处自动换行,无法可靠附到单个 diff 行。处理要求:请修复并提交新的 commit。 建议本地运行:
make lint
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.

Comment on lines +15 to +24
import math

import paddle
from paddle import nn
import paddle.nn.functional as F

from ...nn.attention.interface import ALL_ATTENTION_FUNCTIONS
from ...nn.embedding import Embedding as GeneralEmbedding
from ...nn.linear import Linear as GeneralLinear
from ..cache_utils import Cache, DynamicCache

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.

P0 优先级:P0
处理要求:请针对该评论修复并提交新的 commit。

当前 Lint 检查失败,日志里 flake8 明确报出 mathCache 是未使用导入,同时 isort 也会改写这个文件。这个 import block 会阻塞 CI 合入;请删除未使用导入并按 isort 顺序整理,之后重新运行 lint。

Suggested change
import math
import paddle
from paddle import nn
import paddle.nn.functional as F
from ...nn.attention.interface import ALL_ATTENTION_FUNCTIONS
from ...nn.embedding import Embedding as GeneralEmbedding
from ...nn.linear import Linear as GeneralLinear
from ..cache_utils import Cache, DynamicCache
import paddle
import paddle.nn.functional as F
from paddle import nn
from ...nn.attention.interface import ALL_ATTENTION_FUNCTIONS
from ...nn.embedding import Embedding as GeneralEmbedding
from ...nn.linear import Linear as GeneralLinear
from ..cache_utils import DynamicCache

Comment on lines +1 to +6
import unittest
from unittest.mock import patch

import paddle

import paddle.nn.functional as F

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.

P0 优先级:P0
处理要求:请针对该评论修复并提交新的 commit。

Lint 日志显示 copyright_checkerisort 都会修改新增的测试文件。这里缺少仓库要求的版权头,且 paddle 相关 import 被多余空行拆开,会导致 lint 持续失败。请补齐版权头并整理 import。

Suggested change
import unittest
from unittest.mock import patch
import paddle
import paddle.nn.functional as F
# Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from unittest.mock import patch
import paddle
import paddle.nn.functional as F

@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.

已复查最新 commit。此前 P0 lint 问题已经通过本次提交修复,TeleChat TP 路径和 RoPE dtype 的代码修复也仍然保留;当前没有发现新的行级问题。

本地环境仍缺少 paddle,未能复跑新增单测。当前还有部分 CI 任务在运行中;另外此前 P2 线程仍需要作者在对应评论下回复 Done 或说明理由后,我再提交批准。

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

@Paddle-CI-Bot

Paddle-CI-Bot commented Jul 18, 2026

Copy link
Copy Markdown

PaddleFormers Log Analysis

Run #33622034752 · Attempt 1

日志分析报告

流水线名称 问题标签 修复建议 日志片段
Fleet Model Test / Integration test (H20, multi-card) 其他(libuv assertion + NCCL unhandled cuda error) 与本PR无关,H20 runner 存在 libuv assertion 失败(exit code -6)及 NCCL unhandled cuda error,均为 runner 侧底层异常,建议 rerun 报错代码
Unittest GPU CI / upload-coverage runner GLIBC 版本不兼容 与本PR无关,runner ernie-cpu-04(yq01-bfs-cs52)上 node24 二进制依赖 GLIBC_2.25/2.27/2.28,但宿主机 glibc 版本过低,CI 维护人员需升级该 runner 的 OS 或降级 actions-runner node 版本 报错代码
CI_XPU / Clone-Linux / code-clone 其他(日志 blob 已过期) 与本PR无关,该 step 仅用时 ~1s 即失败(09:13:32→09:13:33),日志 blob 已过期(BlobNotFound),xpu_test 被 skip;需 CI 维护人员检查 XPU runner clone 逻辑或直接 rerun 报错代码

失败的测试case:

Fleet Model Test / Integration test (H20, multi-card):
  - glm45/dpo          — exit code -6, libuv uv__finish_close assertion, 未到达 ***** eval metrics *****
  - glm45_ep4/pt       — exit code 241, OSError: NCCL unhandled cuda error (process_group_nccl.cc:912), 未到达 ***** train metrics *****
  - qwen3vl_moe/sft    — exit code 250, libuv assertion, 未到达 ***** train metrics *****

Unittest GPU CI:
  - upload-coverage    — node24 GLIBC_2.25/2.27/2.28 not found on runner ernie-cpu-04

CI_XPU:
  - Clone-Linux / code-clone — ~1s 即失败,日志 blob 已过期,xpu_test skipped

根本原因分析:
三条流水线的失败均与本 PR(feat/add-telechat-model)代码改动无关:Fleet H20 多卡出现 libuv assertion crash(exit -6)和 NCCL unhandled CUDA error,属 H20 runner 底层 GPU/驱动不稳定问题;upload-coverage 失败因 runner yq01-bfs-cs52 系统 glibc 版本过低无法运行 node24;CI_XPU clone 步骤在 1 秒内即退出,日志已过期,无法进一步确认,但不影响正常测试逻辑。

修复建议:

  1. Fleet Model Test:直接 rerun,若连续两次出现相同 libuv/NCCL 错误,上报 CI 维护人员检查 H20 runner GPU 驱动状态。
  2. Unittest GPU CI upload-coverage:CI 维护人员在 ernie-cpu-04(yq01-bfs-cs52)上升级 OS glibc 至 ≥2.28,或将 actions-runner externals 中 node24 降级为兼容当前 glibc 的版本。
  3. CI_XPU:直接 rerun;若再次在 1s 内 clone 失败,CI 维护人员检查 XPU runner 上的 git 配置及网络连通性。

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

🔄 每次 Re-run 后自动更新

"gpt_oss.configuration": ["GptOssConfig"],
"gpt_oss.modeling": ["GptOssModel", "GptOssForCausalLM", "GptOssForCausalLMPipe"],

"telechat.configuration": ["TelechatConfig"],

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.

P0 当前提交的 make lint/Black 检查仍失败:CI 会重写本文件,并同时报告 paddleformers/transformers/auto/configuration.py 需要格式化。请在提交前运行 make lint(或 black)并提交格式化后的两个文件,否则 Codestyle Check 持续失败,无法合并。

def __init__(self, config):
super().__init__()
self.head_dim = config.hidden_size // config.n_head
inv_freq = 1.0 / (10000.0 ** (paddle.arange(0, self.head_dim, 2, dtype="float32") / self.head_dim))

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.

P1 这里固定使用 base=10000,完全没有使用配置中的 training_seqlen/base_seqlen。TeleChat 官方在序列长度超过 training_seqlen 时会按 NTK alpha 调整 base 和缩放;当前实现对超过 8192 的输入仍使用训练上下文的频率,长上下文位置编码和模型输出会与发布权重不一致。请按有效序列长度实现动态缩放,并补充长上下文测试。

)
residual = hidden_states
hidden_states = self.post_attention_layernorm(hidden_states)
return residual + self.mlp(hidden_states)

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.

P1 配置中的 hidden_dropout 在此层完全未使用。TeleChat 官方在 attention dense 和 MLP 输出的 residual add 前均执行 hidden_dropout;7B 发布配置的值为 0.1。当前加载该配置时训练路径没有任何 hidden dropout,训练行为与发布权重/官方实现不兼容。请在两处 residual add 前应用 config.hidden_dropout,并添加 training-mode 覆盖测试。

position_embeddings=None,
past_key_values=None,
):
residual = hidden_states

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.

P1 apply_residual_connection_post_layernorm 虽然在 TelechatConfig 中暴露,但这里始终使用 LayerNorm 前的 hidden_states 作为 residual,因此将该选项设为 True 没有任何效果。官方实现会在 attention 和 MLP 两个 residual 分支都改用归一化后的输出。请保存并应用该配置开关,覆盖 True 分支的前向测试。

query_states, key_states = apply_rotary_pos_emb(query_states, key_states, *position_embeddings)
if past_key_values is not None:
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
attention_interface = ALL_ATTENTION_FUNCTIONS["sdpa"]

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.

P2 这里把注意力后端硬编码为 sdpa,导致 config._attn_implementation(如 eagerflashmask)被忽略。create_causal_mask_and_row_indices 已根据该配置决定是否生成稀疏索引,因此设置 flashmask 时仍会走 SDPA 并失去预期的融合后端和性能。请按配置选择 ALL_ATTENTION_FUNCTIONS 中的实现,并补充后端路由测试。

@Paddle-Bot Paddle-Bot 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.

Paddle-Bot Review Board (review完成)

序号 位置 优先级 规则来源 状态
1 Lint 格式检查 P0 默认规则
2 长上下文 RoPE P1 默认规则
仓库规则:基础评审规则
3 Hidden Dropout P1 默认规则
仓库规则:基础评审规则
4 残差连接配置 P1 默认规则
仓库规则:基础评审规则
5 注意力后端路由 P2 默认规则
仓库规则:基础评审规则
Powered by Nyanpasu with gpt-5.6-sol 默认推理级别, please check the suggestions carefully.

@cf-icehzgzh
cf-icehzgzh force-pushed the feat/add-telechat-model branch from af44885 to 844d7cf Compare September 2, 2026 08:26

@Paddle-Bot Paddle-Bot 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.

当前 head 已完成注册文件格式化,原 P0 已修复;长上下文 RoPE、hidden_dropout、残差连接配置和注意力后端路由仍未修改,具体位置和状态见既有 Review Board。

Powered by Nyanpasu with gpt-5.6-sol 默认推理级别, please check the suggestions carefully.

@Paddle-Bot

Paddle-Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Failed CI看板

流水线名称 问题标签 修复建议 日志片段
Unittest GPU CI(upload-coverage) CI 基础设施:runner 的 GLIBC 与 Node24 不兼容 【与当前改动无关】升级或更换 runner,使 GLIBC 满足 Node24 要求(至少 GLIBC_2.28),修复后重跑该 job 报错代码
日志分析报告

失败的测试 case:

upload-coverage
- 测试 case:无,测试尚未启动
- 失败步骤:Run actions/checkout@v5
- 关键错误:
  /home/paddle-1/runner_05/actions-runner/externals/node24/bin/node:
  /lib64/libm.so.6: version `GLIBC_2.27' not found
  /lib64/libc.so.6: version `GLIBC_2.28' not found
- Post job cleanup 阶段重复出现相同 Node24/GLIBC 错误

根本原因分析:

首个真实错误发生在 actions/checkout@v5 启动阶段:runner 上的 /lib64/libc.so.6libm.so.6 缺少 Node24 所需的 GLIBC_2.25GLIBC_2.27GLIBC_2.28 符号。说明执行环境的系统 GLIBC 版本过旧,导致 GitHub Action runtime 无法启动。

失败发生在 checkout 完成前,仓库代码未被执行,PR 新增的 TeleChat 模型、自动注册逻辑和测试用例均未进入测试流程;coverage 上传也未执行。清理阶段的重复报错属于同一环境故障的级联错误,不是独立根因。

PR diff 未修改 workflow、runner 镜像、系统依赖或 Node runtime,因此本次失败应归类为【与当前改动无关】的 CI 基础设施问题,而不是 TeleChat 代码问题。

修复建议:

  1. 【与当前改动无关】upload-coverage:升级 ernie-cpu-05 的 runner 基础系统或切换到兼容 Node24 的 runner,确保 GLIBC 至少为 2.28,然后重新运行 Unittest GPU CI

Powered by Nyanpasu with gpt-5.6-luna 默认推理级别, please check the suggestions carefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants