# convert_to_onnx.py
import torch
import torch.nn as nn
import math
from torch.nn import functional as F
from typing import List
from functools import partial
import onnxruntime
import numpy as np
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
class DWConv(nn.Module):
def __init__(self, dim=768):
super(DWConv, self).__init__()
self.dwconv = nn.Conv2d(dim, dim, 3, 1, 1, bias=True, groups=dim)
def forward(self, x, H, W):
B, N, C = x.shape
x = x.transpose(1, 2).view(B, C, H, W)
x = self.dwconv(x)
x = x.flatten(2).transpose(1, 2)
return x
def _conv_filter(state_dict, patch_size=16):
""" convert patch embedding weight from manual patchify + linear proj to conv"""
out_dict = {}
for k, v in state_dict.items():
if 'patch_embed.proj.weight' in k:
v = v.reshape((v.shape[0], 3, patch_size, patch_size))
out_dict[k] = v
return out_dict
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0., linear=False):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
self.fc1 = nn.Linear(in_features, hidden_features)
self.dwconv = DWConv(hidden_features)
self.act = act_layer()
self.fc2 = nn.Linear(hidden_features, out_features)
self.drop = nn.Dropout(drop)
self.linear = linear
if self.linear:
self.relu = nn.ReLU(inplace=True)
self.apply(self._init_weights)
def _init_weights(self, m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
elif isinstance(m, nn.Conv2d):
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
fan_out //= m.groups
m.weight.data.normal_(0, math.sqrt(2.0 / fan_out))
if m.bias is not None:
m.bias.data.zero_()
def forward(self, x, H, W):
x = self.fc1(x)
if self.linear:
x = self.relu(x)
x = self.dwconv(x, H, W)
x = self.act(x)
x = self.drop(x)
x = self.fc2(x)
x = self.drop(x)
return x
class Attention(nn.Module):
def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0., sr_ratio=1, linear=False):
super().__init__()
assert dim % num_heads == 0, f"dim {dim} should be divided by num_heads {num_heads}."
self.dim = dim
self.num_heads = num_heads
head_dim = dim // num_heads
self.scale = qk_scale or head_dim ** -0.5
self.q = nn.Linear(dim, dim, bias=qkv_bias)
self.kv = nn.Linear(dim, dim * 2, bias=qkv_bias)
self.attn_drop = nn.Dropout(attn_drop)
self.proj = nn.Linear(dim, dim)
self.proj_drop = nn.Dropout(proj_drop)
self.linear = linear
self.sr_ratio = sr_ratio
if not linear:
if sr_ratio > 1:
self.sr = nn.Conv2d(dim, dim, kernel_size=sr_ratio, stride=sr_ratio)
self.norm = nn.LayerNorm(dim)
else:
self.pool = nn.AdaptiveAvgPool2d(7)
self.sr = nn.Conv2d(dim, dim, kernel_size=1, stride=1)
self.norm = nn.LayerNorm(dim)
self.act = nn.GELU()
self.apply(self._init_weights)
def _init_weights(self, m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
elif isinstance(m, nn.Conv2d):
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
fan_out //= m.groups
m.weight.data.normal_(0, math.sqrt(2.0 / fan_out))
if m.bias is not None:
m.bias.data.zero_()
def forward(self, x, H, W):
B, N, C = x.shape
q = self.q(x).reshape(B, N, self.num_heads, C // self.num_heads).permute(0, 2, 1, 3)
if not self.linear:
if self.sr_ratio > 1:
x_ = x.permute(0, 2, 1).reshape(B, C, H, W)
x_ = self.sr(x_).reshape(B, C, -1).permute(0, 2, 1)
x_ = self.norm(x_)
kv = self.kv(x_).reshape(B, -1, 2, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
else:
kv = self.kv(x).reshape(B, -1, 2, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
else:
x_ = x.permute(0, 2, 1).reshape(B, C, H, W)
x_ = self.sr(self.pool(x_)).reshape(B, C, -1).permute(0, 2, 1)
x_ = self.norm(x_)
x_ = self.act(x_)
kv = self.kv(x_).reshape(B, -1, 2, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
k, v = kv[0], kv[1]
attn = (q @ k.transpose(-2, -1)) * self.scale
attn = attn.softmax(dim=-1)
attn = self.attn_drop(attn)
x = (attn @ v).transpose(1, 2).reshape(B, N, C)
x = self.proj(x)
x = self.proj_drop(x)
return x
class Block(nn.Module):
def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop=0., attn_drop=0.,
drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm, sr_ratio=1, linear=False):
super().__init__()
self.norm1 = norm_layer(dim)
self.attn = Attention(
dim,
num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale,
attn_drop=attn_drop, proj_drop=drop, sr_ratio=sr_ratio, linear=linear)
# NOTE: drop path for stochastic depth, we shall see if this is better than dropout here
self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity()
self.norm2 = norm_layer(dim)
mlp_hidden_dim = int(dim * mlp_ratio)
self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop, linear=linear)
self.apply(self._init_weights)
def _init_weights(self, m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
elif isinstance(m, nn.Conv2d):
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
fan_out //= m.groups
m.weight.data.normal_(0, math.sqrt(2.0 / fan_out))
if m.bias is not None:
m.bias.data.zero_()
def forward(self, x, H, W):
x = x + self.drop_path(self.attn(self.norm1(x), H, W))
x = x + self.drop_path(self.mlp(self.norm2(x), H, W))
return x
class OverlapPatchEmbed(nn.Module):
""" Image to Patch Embedding
"""
def __init__(self, img_size=224, patch_size=7, stride=4, in_chans=3, embed_dim=768):
super().__init__()
img_size = to_2tuple(img_size)
patch_size = to_2tuple(patch_size)
assert max(patch_size) > stride, "Set larger patch_size than stride"
self.img_size = img_size
self.patch_size = patch_size
self.H, self.W = img_size[0] // stride, img_size[1] // stride
self.num_patches = self.H * self.W
self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=stride,
padding=(patch_size[0] // 2, patch_size[1] // 2))
self.norm = nn.LayerNorm(embed_dim)
self.apply(self._init_weights)
def _init_weights(self, m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
elif isinstance(m, nn.Conv2d):
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
fan_out //= m.groups
m.weight.data.normal_(0, math.sqrt(2.0 / fan_out))
if m.bias is not None:
m.bias.data.zero_()
def forward(self, x):
x = self.proj(x)
_, _, H, W = x.shape
x = x.flatten(2).transpose(1, 2)
x = self.norm(x)
return x, H, W
# 定义模型
class PyramidVisionTransformerV2(nn.Module):
def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classes=2, embed_dims=[64, 128, 256, 512],
num_heads=[1, 2, 4, 8], mlp_ratios=[4, 4, 4, 4], qkv_bias=False, qk_scale=None, drop_rate=0.,
attn_drop_rate=0., drop_path_rate=0., norm_layer=nn.LayerNorm,
depths=[3, 4, 6, 3], sr_ratios=[8, 4, 2, 1], num_stages=4, linear=False):
super().__init__()
self.num_classes = num_classes
self.depths = depths
self.num_stages = num_stages
dpr = [x.item() for x in torch.linspace(0, drop_path_rate, sum(depths))] # stochastic depth decay rule
cur = 0
for i in range(num_stages):
patch_embed = OverlapPatchEmbed(img_size=img_size if i == 0 else img_size // (2 ** (i + 1)),
patch_size=7 if i == 0 else 3,
stride=4 if i == 0 else 2,
in_chans=in_chans if i == 0 else embed_dims[i - 1],
embed_dim=embed_dims[i])
block = nn.ModuleList([Block(
dim=embed_dims[i], num_heads=num_heads[i], mlp_ratio=mlp_ratios[i], qkv_bias=qkv_bias, qk_scale=qk_scale,
drop=drop_rate, attn_drop=attn_drop_rate, drop_path=dpr[cur + j], norm_layer=norm_layer,
sr_ratio=sr_ratios[i], linear=linear)
for j in range(depths[i])])
norm = norm_layer(embed_dims[i])
cur += depths[i]
setattr(self, f"patch_embed{i + 1}", patch_embed)
setattr(self, f"block{i + 1}", block)
setattr(self, f"norm{i + 1}", norm)
# classification head
self.head = nn.Linear(embed_dims[3], num_classes) if num_classes > 0 else nn.Identity()
self.apply(self._init_weights)
def _init_weights(self, m):
if isinstance(m, nn.Linear):
trunc_normal_(m.weight, std=.02)
if isinstance(m, nn.Linear) and m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.LayerNorm):
nn.init.constant_(m.bias, 0)
nn.init.constant_(m.weight, 1.0)
elif isinstance(m, nn.Conv2d):
fan_out = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
fan_out //= m.groups
m.weight.data.normal_(0, math.sqrt(2.0 / fan_out))
if m.bias is not None:
m.bias.data.zero_()
def freeze_patch_emb(self):
self.patch_embed1.requires_grad = False
@torch.jit.ignore
def no_weight_decay(self):
return {'pos_embed1', 'pos_embed2', 'pos_embed3', 'pos_embed4', 'cls_token'} # has pos_embed may be better
def get_classifier(self):
return self.head
def reset_classifier(self, num_classes, global_pool=''):
self.num_classes = num_classes
self.head = nn.Linear(self.embed_dim, num_classes) if num_classes > 0 else nn.Identity()
def forward_features(self, x):
B = x.shape[0]
for i in range(self.num_stages):
patch_embed = getattr(self, f"patch_embed{i + 1}")
block = getattr(self, f"block{i + 1}")
norm = getattr(self, f"norm{i + 1}")
x, H, W = patch_embed(x)
for blk in block:
x = blk(x, H, W)
x = norm(x)
if i != self.num_stages - 1:
x = x.reshape(B, H, W, -1).permute(0, 3, 1, 2).contiguous()
return x.mean(dim=1)
def forward(self, x):
x = self.forward_features(x)
x = self.head(x)
return x
# 加载模型
def load_model(model_path):
model = PyramidVisionTransformerV2(
patch_size=4,
embed_dims=[64, 128, 320, 512],
num_heads=[1, 2, 5, 8],
mlp_ratios=[4, 4, 4, 4],
qkv_bias=True,
norm_layer=partial(nn.LayerNorm, eps=1e-6),
depths=[3, 6, 40, 3],
sr_ratios=[8, 4, 2, 1]
)
model.load_state_dict(torch.load(model_path))
model.eval()
return model
# 转换为 ONNX
def convert_to_onnx(model, model_path, output_onnx_path):
# 创建示例输入
dummy_input = torch.randn(1, 3, 224, 224)
# 导出模型到 ONNX
torch.onnx.export(
model,
dummy_input,
output_onnx_path,
export_params=True, # 存储模型参数
opset_version=11, # ONNX版本
do_constant_folding=True, # 是否执行常量折叠优化
input_names=['input'], # 输入节点名称
output_names=['output'], # 输出节点名称
dynamic_axes={'input': {0: 'batch_size'}, # 可变维度
'output': {0: 'batch_size'}}
)
print("Model has been converted to ONNX format.")
# 验证 ONNX 模型
def verify_onnx(model, onnx_model_path):
# 加载 ONNX 模型
session = onnxruntime.InferenceSession(onnx_model_path)
# 创建示例输入
input_name = session.get_inputs()[0].name
x = np.random.randn(1, 3, 224, 224).astype(np.float32)
# 运行模型
result = session.run(None, {input_name: x})
print("ONNX model output:", result)
# 使用 PyTorch 模型进行预测
with torch.no_grad():
pytorch_result = model(torch.from_numpy(x)).numpy()
# 比较 ONNX 和 PyTorch 的结果
np.testing.assert_allclose(pytorch_result, result[0], rtol=1e-03, atol=1e-05)
print("ONNX and PyTorch results are close!")
# 主函数
def main():
model_path = 'checkpoints/pvt_v2_b5/checkpoint_0.pth' # 模型路径
output_onnx_path = 'checkpoints/pvt_v2_b5/checkpoint_0.onnx' # 输出 ONNX 文件路径
# 加载模型
model = load_model(model_path)
# 转换为 ONNX
convert_to_onnx(model, model_path, output_onnx_path)
# 验证 ONNX 模型
verify_onnx(model, output_onnx_path)
if __name__ == '__main__':
main()
相关推荐
基于AutoDL复现A-LOAM
Ceres solver 是谷歌开发的一款用于非线性优化的库,在谷歌的开源激光雷达slam项目cartographer中被大量使用。在autodl上面租服务器,地区我租的重庆A区的,GPU我选择的是RTX4090,基础镜像选择的是Miniconda / conda3 / 3.8(ubuntu20.04)/11.6。在AutoDL中我使用的方式是先将该数据集先下载到自己的电脑上,然后再上传到虚拟机中。用MobaXterm解决该问题!搜到的一个解决方式:该问题属于ceres版本问题,将A-LOAM下的。
pth文件转化为onnx文件
然后验证一下模型的输入大小。然后验证一下模型是否正确。
SuperPoint与SuperGlue的C++ TensorRT工程化实战:从理论到部署的完整指南
本文详细介绍了如何将SuperPoint和SuperGlue算法通过C++和TensorRT进行工程化部署,从模型准备、格式转换到TensorRT引擎构建和C++推理实现。通过性能优化技巧和实际应用案例,展示了在边缘设备上实现实时特征匹配的完整流程,显著提升处理速度与效率。
PVT 开源项目教程
PVT 开源项目教程 项目地址:https://gitcode.com/gh_mirrors/pv/PVT 项目介绍 PVT(Pyramid Vision Transformer)是一个基于Transformer的视觉模型,旨在处理图像识别和分割任务。该项目由Wenhai Wang、Enze Xie和Zhe Chen维护,提供了多种预训练模型和工具,以便于研究人员和开发者快速部署和应用。 项目快速...
理想汽车智驾方案介绍 4 World model + 强化学习重建自动驾驶交互环境
本帖将以 DrivingSphere 为例来解析这个过程。
F5 GTM DNS 实战指南:智能DNS的监控与健康检查机制
本文深入解析F5 BIG-IP GTM智能DNS的核心机制,重点阐述其监控与探针两大功能如何协同工作。监控器负责深度检查服务器应用健康,确保服务可用性;探针则实时测量网络路径质量,实现基于延迟的智能流量调度。文章通过实战配置步骤,指导如何构建逻辑架构、建立iQuery通信、配置业务级健康检查及探针,从而构建高可用、高性能的全局负载均衡解决方案。
PVT训练后的.pth模型转为.onnx模型1.1
【代码】PVT训练后的.pth模型转为.onnx模型1.1。
状态转移矩阵在离散控制系统中的应用与实现步骤详解
本文深入解析了状态转移矩阵在离散控制系统中的核心作用与实现步骤。通过一个具体实例,详细演示了如何将连续状态空间模型精确离散化,计算出离散系统矩阵A_d和B_d,并分享了采样周期选择、数值计算技巧及嵌入式C语言实现等关键工程经验,为开发高性能数字控制器提供实用指南。
如何将 keras_cv_attention_models 导出为 ONNX:精度验证与 TensorRT T4 基准测试完整教程
`keras_cv_attention_models`(别名 `kecam`)是一个用 Keras 实现的注意力视觉模型大全,内置 BEiT、ConvNeXt、EfficientNet、CoAtNet、YOLOv8 等数十个主流识别与检测模型,并提供预训练权重。本教程带你完成三件事:把模型**导出为 ONNX 格式**、用 **ONNX 精度验证**确认转换无损、再在 **TensorRT T4
Transformer实战(39)——多模态生成式Transformer
能够理解多种类型输入的模型被称为多模态模型。多模态学习是人工智能 (Artificial Intelligence, AI) 领域的重要研究方向之一,长期受到众多研究人员的关注。本节将介绍使用多模态模型的生成式 AI,包括文本到图像 (text-to-image) 和文本到音乐 (text-to-music) 的生成模型。将介绍 Stable Diffusion 及其工作原理,同时也将介绍 MusicGen 和 AudioGen 模型。
K8s-K8s部署Zookeeper+Kafka+ELFK+持久化数据
K8s环境下容器化部署`Zookeeper+Kafka+ELFK`日志收集系统
keras_cv_attention_models PyTorch后端实战:KECAM_BACKEND=torch一键切换训练推理
keras_cv_attention_models(别名 **kecam**)是一个收录 50 余种前沿注意力视觉模型的 Keras 模型库,涵盖 BEiT、ConvNeXt、MobileViT、YOLOv8、GPT-2、Llama2 等。最实用的能力之一是:只需设置一个环境变量 `KECAM_BACKEND=torch`,即可让全部模型在 **PyTorch 后端**上完成训练与推理,无需改写任
从源码编译CesiumForUnreal
从源码编译CesiumForUnreal插件
three-man-team工作流全解析:六步法如何防止AI编程跑偏(附完整Sprint实战演练)
three-man-team 是一套面向 AI 编程的结构化三智能体开发框架,由 Architect(架构师)、Builder(构建者)、Reviewer(审查者)组成,用固定的六步工作流(Plan → Brief → Build → Review → Deploy → Log)防止 AI 编程跑偏。它内置文件交接、部署门控与 Token 优化机制,可在 Claude Code、VS Code、C
Probability and Statistics - 4th edition
Probability and Statistics - 4th edition
RU DOS版、EFI版32bit/64bit BIOS常用工具
DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。
计算机视觉十大经典算法:从图像处理到目标检测与分割的完整指南
计算机视觉作为人工智能的核心领域,旨在让机器具备理解和分析图像内容的能力。其技术原理主要围绕特征提取、模式识别和深度学习展开,通过算法模型从像素数据中学习语义信息。这一技术的核心价值在于将非结构化的视觉数据转化为可理解、可操作的洞察,极大地提升了自动化水平和决策效率。在应用场景上,计算机视觉已广泛应用于工业质检、自动驾驶、医疗影像分析、安防监控和增强现实等领域。本文聚焦于计算机视觉的经典算法体系,系统梳理了从基础的图像处理与特征提取(如SIFT、HOG),到核心的目标检测(如YOLO系列),再到高级的图像分
TMS_WebGMaps_1.9.8.0_Full_Source
TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder
【机器学习300问】139、Post-LN 和 Pre-LN 的区别?
Post-LN与Pre-LN的核心区别在于LayerNorm的位置:Post-LN在残差连接后,导致梯度需经LayerNorm变换,深层易出现梯度衰减或震荡;Pre-LN先做归一化,使输入稳定,残差路径梯度可无损回传,显著提升深层训练稳定性。尽管Pre-LN支持更深层次模型(如LLaMA、Qwen),但存在“深度诅咒”——深层贡献不足。相比之下,Post-LN浅层表现尚可,深层数易发散。因此,现代大模型普遍采用Pre-LN以保障训练可靠性。
蓝牙模块HM-10手册
蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。
为什么生成对抗网络训练常不稳定,模式崩溃与判别器过强之间是什么关系?
当支持集不重叠时(即 $D$ 能完美区分真假),JS 散度为常数 $\log 2$,其梯度为 0。这意味着一旦 $D$ 训练得稍好,$G$ 就失去了学习方向,导致训练停滞。生成对抗网络(GAN)的训练本质上是生成器($G$)与判别器($D$)之间的非合作零和博弈。以下代码展示了如何通过梯度惩罚(Gradient Penalty)来约束判别器,避免其过强导致生成器梯度失效。判别器过强是导致模式崩溃的直接诱因之一,二者之间存在明确的**“梯度误导”**因果关系。
Spark06_MLlib机器学习
本文是《PySpark 从入门到实战》系列收官篇,带你用 Spark MLlib 走通机器学习全流程:从三要素与 7 步标准流程讲起,剖析 KNN、朴素贝叶斯、决策树三大算法原理,再以 KNN 手写、垃圾短信分类、决策树分类、逻辑回归鸢尾花(准确率 96.67%)、K-Means 聚类(轮廓系数 0.7345)五个案例落地,最后详解 TF-IDF 文本特征与余弦相似度。全文代码可直接运行,适合有 RDD 与 Spark SQL 基础的开发者快速上手。
机器学习教程,从入门到精通,高斯混合模型(GMM)——写给机器学习小白的保姆级教程(10)
高斯混合模型(Gaussian Mixture Model,简称 GMM):假设你手里的数据是由"好几堆正态分布的数据混在一起"形成的,GMM 的任务就是——把这几堆分开,并且描述清楚每一堆的样子。
机器学习01,KNN使用与简单数学原理
个人笔记
【人工智能驱动的电催化研究-01】人工智能是什么?AI、机器学习、深度学习和神经网络之间有什么区别?
介绍人工智能、机器学习、神经网络和深度学习的基本概念及相互关系。围绕催化剂性能预测,解释样本、特征、标签、模型、参数、训练、预测与验证的含义。结合二硫化钼边缘位点与析氢活性的研究案例,说明科学问题如何指导特征选择。利用真实文献中的析氢数据,通过手算和Python实践,对比人工规则与均值模型,理解参数学习和误差评价。强调数据学习不保证预测更优,相关性不能直接证明反应机理,文献数据还须核查实验条件与适用范围,为后续编程、数学和电催化机器学习课程建立基础。
机器学习01,了解与KNN
个人笔记
【slam公式】
F:状态转移矩阵H:观测矩阵R: 观测噪声协方差。
机器学习-支持向量机
本文通过多个案例深入解析SVM在二分类、多分类及高维文本数据中的应用。基于乳腺癌数据集,构建标准化+SVM的流水线,结合网格搜索优化C与gamma参数,实现98.02%的测试准确率。通过交叉验证评估模型稳定性,结果显示标准差仅0.0162,表明模型鲁棒性强。引入probability=True后,可输出预测概率,揭示模型不确定性(如样本4的52%良性概率),助力医疗决策。结果表明,特征维度提升需调小gamma、增大C以适应复杂数据,凸显参数与数据特性的交互关系。
基于有效Token规模化的大模型预训练数据配方与工程体系研究——基于唐杰《高级机器学习》课程演讲
在此背景下,本文系统梳理GLM系列模型数据迭代轨迹,纠正数据墙认知偏差,分析天然数据与合成数据的互补机制,并完整构建支撑高质量Token挖掘的全链路数据工程体系,为大模型数据规模化建设提供理论与工程参考。早期小模型训练场景下,数据总量远大于算力可消化量,核心策略为择优筛选少量高质量数据。基于唐杰公开演讲核心观点、GLM数据迭代、数据墙、合成数据、清洗解析工具链、分层架构图、自研工程壁垒),完整重构成一篇结构严谨、逻辑连贯、标准期刊论文风格全文,预留精准图片插入位置,可直接定稿、查重、发表、结课提交。
茶叶病虫害目标检测数据集
目标检测 yolo 目标检测数据集 茶叶病虫害目标检测数据集
1942



被折叠的 条评论
为什么被折叠?



