当前位置: 首页 > article >正文

ONNX模型修改实战:从节点增删到子图提取的完整指南

ONNX模型修改实战从节点增删到子图提取的完整指南在深度学习模型部署的工程实践中ONNX作为跨平台中间表示格式已成为行业标准。但当面对实际业务需求时原始导出的模型往往需要经过结构调整才能适配目标环境。本文将深入剖析ONNX模型修改的核心技术通过具体代码示例演示节点操作、子图提取等高级技巧帮助开发者掌握模型定制化改造的完整方法论。1. ONNX模型结构解析与工具链准备理解ONNX的底层表示是进行模型修改的前提。一个ONNX模型由ModelProto、GraphProto、NodeProto等多层结构组成其中GraphProto包含以下关键组件node计算节点列表构成模型的计算图拓扑input/output模型全局输入输出张量描述initializer存储模型权重参数的持久化数据value_info中间张量的形状和类型信息推荐使用以下工具组合进行高效操作# 基础工具链安装 pip install onnx onnxruntime onnx-simplifier # 高级图操作工具 pip install onnx_graphsurgeon --index-url https://pypi.ngc.nvidia.com对于大于2GB的模型需要特别注意内存处理# 大模型加载示例 onnx_model onnx.load(large_model.onnx, load_external_dataTrue, external_data_dir./weights)2. 节点级操作实战2.1 节点增删与属性修改删除节点时需要处理上下游连接关系。以下示例展示如何安全移除Cast节点并维护图完整性def remove_cast_node(onnx_model, target_node_name): graph onnx_model.graph node_map {node.name: (i, node) for i, node in enumerate(graph.node)} if target_node_name not in node_map: raise ValueError(fNode {target_node_name} not found) node_idx, cast_node node_map[target_node_name] if cast_node.op_type ! Cast: raise TypeError(Target node must be Cast operation) # 建立输入输出映射关系 input_name cast_node.input[0] output_name cast_node.output[0] # 删除节点并更新连接 del graph.node[node_idx] for node in graph.node: for i in range(len(node.input)): if node.input[i] output_name: node.input[i] input_name return onnx_model添加新节点时需要注意拓扑排序。以下是在Conv层后插入Pad操作的典型示例def insert_pad_after_conv(onnx_model, conv_node_name, pads): graph onnx_model.graph conv_node, conv_idx None, 0 # 定位目标卷积节点 for idx, node in enumerate(graph.node): if node.name conv_node_name: conv_node, conv_idx node, idx break if not conv_node: raise ValueError(Conv node not found) # 创建Pad节点和常量节点 new_output_name f{conv_node.output[0]}_padded pad_size_name f{conv_node.output[0]}_pad_size # 修改原始卷积输出名称 original_output conv_node.output[0] conv_node.output[0] new_output_name # 创建Pad尺寸常量节点 pad_size_node onnx.helper.make_node( Constant, inputs[], outputs[pad_size_name], valueonnx.helper.make_tensor( namepad_size, data_typeonnx.TensorProto.INT64, dims[len(pads)], valspads ) ) # 创建Pad节点 pad_node onnx.helper.make_node( Pad, inputs[new_output_name, pad_size_name], outputs[original_output], modeconstant ) # 按拓扑顺序插入新节点 graph.node.insert(conv_idx1, pad_size_node) graph.node.insert(conv_idx2, pad_node) return onnx_model2.2 节点属性动态修改ONNX节点的属性存储在attribute字段中修改时需要遵循proto协议规范def update_node_attr(onnx_model, node_name, attr_name, new_value): graph onnx_model.graph target_node next((n for n in graph.node if n.name node_name), None) if not target_node: raise ValueError(Target node not found) # 删除旧属性 attrs [attr for attr in target_node.attribute if attr.name ! attr_name] target_node.attribute[:] attrs # 添加新属性 if isinstance(new_value, int): new_attr onnx.helper.make_attribute(attr_name, new_value) elif isinstance(new_value, list): new_attr onnx.helper.make_attribute(attr_name, new_value) else: raise TypeError(Unsupported attribute type) target_node.attribute.append(new_attr) return onnx_model3. 子图提取高级技巧3.1 基于官方工具的基础提取ONNX提供内置的extract_model函数实现基础子图提取from onnx import utils def extract_submodel(input_path, output_path, input_names, output_names): try: utils.extract_model(input_path, output_path, input_names, output_names) except ValueError as e: if Model larger than 2GB in str(e): print(使用大模型处理方案...) return extract_large_submodel(input_path, output_path, input_names, output_names) raise3.2 大模型子图提取方案对于超过2GB的模型需要使用onnx_graphsurgeon进行处理import onnx_graphsurgeon as gs def extract_large_submodel(input_path, output_path, input_names, output_names): model onnx.load(input_path) graph gs.import_onnx(model) tensors graph.tensors() # 设置新的输入输出 graph.inputs [tensors[name].to_variable(dtypenp.float32) for name in input_names] graph.outputs [tensors[name].to_variable(dtypenp.float32) for name in output_names] # 清理无效节点 graph.cleanup() # 保存子模型 onnx.save(gs.export_onnx(graph), output_path)3.3 动态形状子图提取当处理动态维度模型时需要特别注意形状传播def extract_dynamic_subgraph(onnx_model, input_names, output_names): # 执行形状推断 inferred_model shape_inference.infer_shapes(onnx_model) # 创建新的GraphProto new_graph onnx.GraphProto() new_graph.name fsubgraph_of_{inferred_model.graph.name} # 复制节点和初始化器 node_mapping set() for node in inferred_model.graph.node: if any(out in output_names for out in node.output): new_graph.node.append(node) node_mapping.add(node.name) # 添加初始器 for init in inferred_model.graph.initializer: if init.name in input_names: new_graph.initializer.append(init) # 设置输入输出 for value_info in inferred_model.graph.value_info: if value_info.name in input_names output_names: new_graph.value_info.append(value_info) # 构建新模型 submodel onnx.helper.make_model( new_graph, opset_importsinferred_model.opset_import ) return submodel4. 模型IO系统改造4.1 输入输出重命名批量修改张量名称时需要同步更新所有引用位置def rename_tensors(onnx_model, name_mapping): graph onnx_model.graph # 更新graph input/output for io in graph.input: if io.name in name_mapping: io.name name_mapping[io.name] for io in graph.output: if io.name in name_mapping: io.name name_mapping[io.name] # 更新节点输入输出 for node in graph.node: for i in range(len(node.input)): if node.input[i] in name_mapping: node.input[i] name_mapping[node.input[i]] for i in range(len(node.output)): if node.output[i] in name_mapping: node.output[i] name_mapping[node.output[i]] # 更新initializer for init in graph.initializer: if init.name in name_mapping: init.name name_mapping[init.name] return onnx_model4.2 动态维度修改调整模型输入输出形状是部署时的常见需求def modify_io_shape(onnx_model, io_shapes): graph onnx_model.graph for io in graph.input: if io.name in io_shapes: new_shape io_shapes[io.name] # 清除原有维度 while io.type.tensor_type.shape.dim: io.type.tensor_type.shape.dim.pop() # 添加新维度 for dim in new_shape: new_dim io.type.tensor_type.shape.dim.add() if isinstance(dim, int): new_dim.dim_value dim else: new_dim.dim_param str(dim) # 执行形状推断以传播新形状 inferred_model shape_inference.infer_shapes(onnx_model) return inferred_model4.3 数据类型转换模型精度调整时可能需要修改IO数据类型def convert_io_dtype(onnx_model, type_mapping): graph onnx_model.graph type_map { float32: onnx.TensorProto.FLOAT, int32: onnx.TensorProto.INT32, int64: onnx.TensorProto.INT64 } for io in graph.input: if io.name in type_mapping: io.type.tensor_type.elem_type type_map[type_mapping[io.name]] for io in graph.output: if io.name in type_mapping: io.type.tensor_type.elem_type type_map[type_mapping[io.name]] return onnx_model5. 调试与验证技术5.1 中间结果提取通过修改输出节点获取中间层结果def add_debug_outputs(onnx_model, tensor_names): graph onnx_model.graph tensor_shapes {} # 收集张量形状信息 for info in graph.value_info: tensor_shapes[info.name] ( [d.dim_value for d in info.type.tensor_type.shape.dim], info.type.tensor_type.elem_type ) # 添加调试输出 for name in tensor_names: if name in tensor_shapes: shape, dtype tensor_shapes[name] graph.output.append( onnx.helper.make_tensor_value_info( namename, elem_typedtype, shapeshape ) ) return onnx_model5.2 模型一致性检查修改后的模型需要进行严格验证def validate_model(onnx_model): try: onnx.checker.check_model(onnx_model) print(模型检查通过) # 验证可运行性 sess onnxruntime.InferenceSession(onnx_model.SerializeToString()) print(模型可执行性验证通过) return True except Exception as e: print(f模型验证失败: {str(e)}) return False5.3 修改前后精度对比确保模型修改不影响计算精度def compare_models(original_model, modified_model, test_input): # 原始模型推理 orig_sess onnxruntime.InferenceSession(original_model.SerializeToString()) orig_output orig_sess.run(None, test_input) # 修改后模型推理 mod_sess onnxruntime.InferenceSession(modified_model.SerializeToString()) mod_output mod_sess.run(None, test_input) # 精度比较 for orig, mod in zip(orig_output, mod_output): if not np.allclose(orig, mod, atol1e-5): max_diff np.max(np.abs(orig - mod)) print(f输出差异过大最大差值: {max_diff}) return False print(模型输出一致) return True6. 性能优化技巧6.1 常量折叠优化使用onnx-simplifier进行自动优化def optimize_with_onnxsim(input_path, output_path): import onnxsim model onnx.load(input_path) simplified_model, check onnxsim.simplify(model) if check: onnx.save(simplified_model, output_path) print(模型优化成功) else: raise RuntimeError(模型优化失败)6.2 自定义优化Pass实现特定场景的优化逻辑def custom_optimization_pass(onnx_model): graph onnx_model.graph optimized_nodes [] i 0 while i len(graph.node): node graph.node[i] # 识别连续的Transpose节点 if node.op_type Transpose and i1 len(graph.node): next_node graph.node[i1] if next_node.op_type Transpose: # 检查是否是转置的逆操作 perm1 list(attr.ints for attr in node.attribute if attr.name perm)[0] perm2 list(attr.ints for attr in next_node.attribute if attr.name perm)[0] if perm1 perm2[::-1]: # 创建直接映射关系 input_name node.input[0] output_name next_node.output[0] # 跳过这两个节点 i 2 # 更新后续节点的输入引用 for subsequent_node in graph.node[i:]: for j in range(len(subsequent_node.input)): if subsequent_node.input[j] output_name: subsequent_node.input[j] input_name continue optimized_nodes.append(node) i 1 # 更新图结构 del graph.node[:] graph.node.extend(optimized_nodes) return onnx_model6.3 内存优化策略处理大模型的实用技巧def optimize_large_model(onnx_model, output_path): # 启用外部数据存储 onnx.save_model( onnx_model, output_path, save_as_external_dataTrue, all_tensors_to_one_fileTrue, locationweights.bin, size_threshold1024 ) # 分片保存选项 # onnx.save_model( # onnx_model, # output_path, # save_as_external_dataTrue, # all_tensors_to_one_fileFalse, # size_threshold1024 # )7. 工程实践中的常见问题解决7.1 自定义算子处理集成自定义算子的实用方案def handle_custom_operators(onnx_model): graph onnx_model.graph custom_ops set() # 识别自定义算子 for node in graph.node: if node.domain not in [, ai.onnx]: custom_ops.add((node.op_type, node.domain)) # 为每个自定义算子添加opset导入 for op_type, domain in custom_ops: existing [opset for opset in onnx_model.opset_import if opset.domain domain] if not existing: onnx_model.opset_import.append( onnx.helper.make_opsetid(domain, 1) ) return onnx_model7.2 形状推断异常处理处理形状推断失败的稳健方案def safe_shape_inference(onnx_model): try: return shape_inference.infer_shapes(onnx_model) except Exception as e: print(f形状推断失败: {str(e)}) print(尝试替代方案...) # 方案1使用onnx-simplifier的形状推断 try: import onnxsim simplified, _ onnxsim.simplify(onnx_model) return simplified except: pass # 方案2部分形状推断 partial_model onnx.ModelProto() partial_model.CopyFrom(onnx_model) del partial_model.graph.value_info[:] return partial_model7.3 跨框架兼容性问题解决框架间转换的典型问题def fix_framework_specific_issues(onnx_model): graph onnx_model.graph # 处理PyTorch导出的冗余维度 for node in graph.node: if node.op_type Squeeze: attrs {attr.name: attr for attr in node.attribute} if axes in attrs and attrs[axes].ints [0]: input_shape get_tensor_shape(graph, node.input[0]) if input_shape and input_shape[0] 1: # 直接绕过不必要的Squeeze bypass_redundant_squeeze(graph, node) # 处理TF导出的特殊属性 for node in graph.node: if node.op_type Transpose and len(node.input) 1: # 将动态perm转换为静态属性 perm_input node.input[1] if perm_input in [init.name for init in graph.initializer]: perm_init next(init for init in graph.initializer if init.name perm_input) perm_value onnx.numpy_helper.to_array(perm_init) new_node onnx.helper.make_node( Transpose, inputs[node.input[0]], outputsnode.output, permperm_value.tolist() ) replace_node(graph, node, new_node) return onnx_model掌握这些ONNX模型修改技术后开发者可以灵活应对各种模型部署场景。在实际项目中建议结合具体需求选择合适的技术组合并建立完善的验证流程确保修改后的模型保持原始计算语义。

相关文章:

ONNX模型修改实战:从节点增删到子图提取的完整指南

ONNX模型修改实战:从节点增删到子图提取的完整指南 在深度学习模型部署的工程实践中,ONNX作为跨平台中间表示格式已成为行业标准。但当面对实际业务需求时,原始导出的模型往往需要经过结构调整才能适配目标环境。本文将深入剖析ONNX模型修改的…...

Phi-3-vision-128k-instruct实际效果:菜单图片识别+多语言翻译+营养成分分析一体化演示

Phi-3-vision-128k-instruct实际效果:菜单图片识别多语言翻译营养成分分析一体化演示 1. 模型简介 Phi-3-Vision-128K-Instruct是一个轻量级的多模态模型,支持128K超长上下文处理能力。这个模型特别擅长处理图文混合的复杂任务,比如菜单识别…...

如何提高DeepSeek-R1首次响应速度?缓存机制优化

如何提高DeepSeek-R1首次响应速度?缓存机制优化 1. 理解首次响应速度的重要性 当你第一次使用DeepSeek-R1模型时,可能会注意到响应速度没有想象中那么快。这不是模型本身的问题,而是因为首次运行时需要加载模型权重、初始化推理环境等一系列…...

人脸识别OOD模型在酒店行业的应用:客户识别系统

人脸识别OOD模型在酒店行业的应用:客户识别系统 1. 引言 酒店行业正面临着前所未有的服务升级压力。想象一下这样的场景:一位客人拖着行李箱走进酒店大堂,前台工作人员立即叫出他的名字:"王先生,欢迎再次光临&a…...

Qwen3-14b_int4_awq企业落地路径:从POC验证到API封装再到业务系统集成

Qwen3-14b_int4_awq企业落地路径:从POC验证到API封装再到业务系统集成 1. 模型简介与核心价值 Qwen3-14b_int4_awq是基于Qwen3-14b模型的int4量化版本,采用AngelSlim技术进行压缩优化,专为文本生成任务设计。该模型在保持较高生成质量的同时…...

华为荣耀V9免TWRP直刷Magisk全攻略(附Shamiko隐藏Root技巧)

1. 华为荣耀V9免TWRP刷Magisk全流程 很多华为荣耀V9用户想要获取Root权限,但苦于找不到适配的TWRP Recovery。其实完全不需要第三方Recovery,用官方镜像就能搞定。我实测了从EMUI 9.1到10.0的多个版本,这个方法都适用。下面就把完整操作流程拆…...

Halcon矩阵变换实战:从原理到代码,手把手实现图像几何变换

1. 图像几何变换的核心原理 当你用手机拍完照片后点击"旋转"按钮时,有没有想过这个看似简单的操作背后藏着怎样的数学魔法?图像几何变换的本质,就是通过矩阵运算重新计算每个像素点的位置。就像玩拼图游戏时移动每一块拼图的位置&a…...

Neeshck-Z-lmage_LYX_v2入门到精通:从环境启动到生成高清大图的完整指南

Neeshck-Z-lmage_LYX_v2入门到精通:从环境启动到生成高清大图的完整指南 1. 引言:开启你的AI绘画之旅 想象一下,你有一台神奇的画布,只需输入文字描述,就能在几分钟内生成专业级的高清图像。Neeshck-Z-lmage_LYX_v2正…...

乙巳马年春联生成终端入门必看:繁体字与简体字双向转换

乙巳马年春联生成终端入门必看:繁体字与简体字双向转换 春节贴春联,是传承千年的文化习俗。一副好对联,不仅寓意吉祥,更能彰显品味。如今,借助AI技术,我们不仅能快速生成文采斐然的春联,还能在…...

AcousticSense AI效果展示:Pop与Electronic在中频段频谱纹理差异解析

AcousticSense AI效果展示:Pop与Electronic在中频段频谱纹理差异解析 1. 引言:当AI学会"看见"音乐 你有没有想过,人工智能不仅能听懂音乐,还能"看见"音乐?AcousticSense AI正是这样一个神奇的系…...

启辰R30近光灯不亮?手把手教你用万用表检测H4灯泡(附保险盒图解)

启辰R30近光灯故障排查指南:从原理到实操的完整解决方案 前言:当爱车的"眼睛"失去光明 深夜驾车回家,突然发现近光灯不亮——这种经历想必让不少启辰R30车主心有余悸。作为车辆夜间行驶的主要照明系统,近光灯故障不仅影…...

PowerMock实战:如何优雅地Mock私有方法(附避坑指南)

PowerMock实战:私有方法Mock的艺术与避坑指南 在金融科技系统开发中,单元测试的完备性直接关系到资金交易的安全性与稳定性。面对那些不得不测试却又被声明为private的核心算法方法,传统测试手段往往束手无策。本文将深入探讨如何运用PowerMo…...

HC-SR04超声波测距传感器工作原理与Arduino驱动实战

HC-SR04超声波测距传感器工作原理与Arduino驱动实战 最近在做一个智能小车的项目,需要让它能感知前方的障碍物,第一时间就想到了HC-SR04这个经典的超声波传感器。它价格便宜、使用简单,是很多创客和嵌入式新手的入门首选。但很多朋友在第一次…...

MATLAB新手必看:如何将struct数据一键导出到Excel(附完整代码)

MATLAB数据处理实战:从Struct到Excel的高效转换指南 在工程计算和科研数据分析中,MATLAB作为一款强大的数值计算工具,经常需要处理各种复杂数据结构。其中,struct(结构体)因其灵活的字段存储方式成为常见的…...

Python实战:5分钟搞定辗转相除法求最大公约数(附完整代码)

Python实战:5分钟掌握辗转相除法的核心实现与优化技巧 在编程面试或日常开发中,计算两个数的最大公约数(GCD)是个高频需求。想象一下这样的场景:你需要快速约分一个分数,或者为加密算法生成密钥对&#xff…...

ROS实战:如何快速将激光雷达点云数据保存为PCD文件(附常见问题解决)

ROS实战:激光雷达点云数据高效保存与深度优化指南 激光雷达作为机器人感知环境的核心传感器,其点云数据的处理效率直接影响着自动驾驶、SLAM等系统的实时性能。但在实际项目中,开发者常会遇到数据保存效率低、格式兼容性差、坐标系错乱等问题…...

软交换 vs 传统程控交换:5个关键区别及现代通信网中的应用场景

软交换与传统程控交换的深度对比:技术演进与组网实践 当运营商开始将核心网从TDM机房迁移到云化架构时,某省级通信公司的工程师发现,原本需要三个月才能完成的局点扩容,现在通过虚拟化软交换平台只需两周即可上线。这个真实案例揭…...

Kotlin开发必知:lateinit和lazy的5个实战场景对比(附避坑指南)

Kotlin开发必知:lateinit和lazy的5个实战场景对比(附避坑指南) 在Kotlin开发中,lateinit和lazy都是延迟初始化的利器,但它们的设计初衷和适用场景却大不相同。很多开发者虽然知道这两个关键字的存在,却常常…...

Janus-Pro-7B效果实测:多轮图片问答中上下文保持能力与逻辑演进

Janus-Pro-7B效果实测:多轮图片问答中上下文保持能力与逻辑演进 1. 引言:当AI开始“看图说话”时,它在想什么? 你有没有遇到过这样的情况?给AI看一张图,问它“这是什么”,它能回答。接着问“为…...

RVC语音转换保姆级教程:3分钟训练专属AI歌手,零基础也能玩

RVC语音转换保姆级教程:3分钟训练专属AI歌手,零基础也能玩 1. 前言:为什么选择RVC? 想象一下,你只需要3分钟的训练时间,就能让AI完美模仿任何人的声音唱歌。这不是科幻电影,而是RVC&#xff0…...

Qwen3-14B轻量部署实践:Qwen3-14b_int4_awq在Jetson Orin上的vLLM边缘部署

Qwen3-14B轻量部署实践:Qwen3-14b_int4_awq在Jetson Orin上的vLLM边缘部署 1. 模型简介 Qwen3-14b_int4_awq是基于Qwen3-14b模型的int4量化版本,采用AngelSlim技术进行压缩优化。这个轻量化版本特别适合在边缘计算设备上运行,能够在保持较高…...

Landsat卫星WRS-2条带号Path/Row查询指南:从理论到实战(附中国区域高清对照图)

Landsat卫星WRS-2条带号精准定位实战手册:中国区域高效查询技巧 当我们需要获取特定区域的Landsat卫星影像时,第一步往往就是确定该区域对应的WRS-2条带号(Path/Row)。这个看似简单的步骤,在实际操作中却可能成为耗时…...

通信工程师必看:奈奎斯特第一准则的5个实战应用场景解析

通信工程师必看:奈奎斯特第一准则的5个实战应用场景解析 在5G基站部署现场,一位资深工程师盯着频谱分析仪上跳动的波形皱起眉头——相邻小区间的信号干扰导致用户下载速率骤降30%。此时,一组关键参数的调整让屏幕上的波形突然变得清晰有序。这…...

【机器学习|评价指标2】从混淆矩阵到实战:精准率、召回率与F1分数的深度解析与代码实现

1. 从混淆矩阵到评价指标:为什么需要精准率和召回率? 当你训练好一个机器学习分类模型后,第一件事就是评估它的表现。这时候混淆矩阵就像是一份成绩单,清晰地告诉你模型在哪些地方做对了,哪些地方犯了错。但仅仅知道TP…...

华为S5720交换机实战:如何用流策略让服务器走专线、员工走普通链路?

华为S5720交换机流量分流实战:业务与办公流量智能调度指南 当企业网络同时承载关键业务流量和普通办公流量时,如何确保服务器专线带宽不被普通上网流量挤占?华为S5720系列交换机的流策略功能提供了一种精细化的解决方案。本文将深入解析如何通…...

电商数仓实战:从业务需求到DWD层设计的完整避坑指南

电商数仓实战:从业务需求到DWD层设计的完整避坑指南 1. 电商数仓设计的核心挑战与应对策略 在电商行业的数据仓库建设中,业务需求与数据模型之间的鸿沟往往是项目失败的首要原因。许多团队在初期容易陷入两个极端:要么过度关注技术实现而忽视…...

VirtualVM内存泄漏排查全攻略:从堆转储到线程分析

VirtualVM内存泄漏排查全攻略:从堆转储到线程分析 当Java应用在生产环境运行数周后突然响应迟缓,监控系统显示内存占用曲线呈"阶梯式"增长——这往往是内存泄漏的典型信号。作为开发者,我们需要像侦探一样,从堆内存的蛛…...

BEYOND REALITY Z-Image在VMware虚拟化环境中的部署

BEYOND REALITY Z-Image在VMware虚拟化环境中的部署 想在本地环境体验专业级AI图像生成?BEYOND REALITY Z-Image提供了出色的图像生成质量,本文将手把手教你在VMware中部署这一强大模型。 1. 环境准备与系统要求 在开始部署之前,我们需要确保…...

2026年免费降AI率网站实测榜:4款主流工具深度对比,教你选对不踩坑

2026年免费降AI率网站实测榜:4款主流工具深度对比,教你选对不踩坑2026年免费降AI率网站实测榜:4款主流工具深度对比,教你选对不踩坑AI写作的普及,让“快速产出内容”成为可能,但随之而来的“AI率过高”问题…...

浦语灵笔2.5-7B算力优化:Flash Attention 2.7.3 + bfloat16提速实测

浦语灵笔2.5-7B算力优化:Flash Attention 2.7.3 bfloat16提速实测 1. 优化背景与技术方案 浦语灵笔2.5-7B作为上海人工智能实验室开发的多模态视觉语言大模型,基于InternLM2-7B架构,融合了CLIP ViT-L/14视觉编码器,在图文混合理…...