1 Star 0 Fork 52

黄灵韵 / 紫东太初多模态大模型

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

紫东太初多模态大模型

“紫东太初”跨模态通用人工智能平台是由中国科学院自动化研究所研发的以多模态大模型为核心、基于全栈国产化基础软硬件平台,可支撑全场景AI应用。依托面向超大规模的高效分布式训练框架,自动化所构建了具有业界领先性能的中文预训练模型、语音预训练模型、视觉预训练模型,并开拓性地通过跨模态语义关联实现了视觉-文本-语音三模态统一表示,构建了三模态预训练大模型,赋予跨模态通用人工智能平台多种核心能力。

“紫东太初”兼具跨模态理解和生成能力,具有了在无监督情况下多任务联合学习、并快速迁移到不同领域数据的强大能力。对更广泛、更多样的下游任务提供模型基础支撑,达成AI在如视频配音、语音播报、标题摘要、海报创作等更多元场景的应用。

特色:

  • 全球首个多模态图文音预训练模型

  • 多层次多任务自监督学习

  • 弱关联多模态数据语义统一表达

  • 兼顾任务感知和推理增强的中文预训练模型

  • 多粒度学习与注意力指导的视觉预训练模型

  • 基于自监督预训练的多任务语音建模技术

中文预训练模型

文本预训练模型使用条件语言模型作为自监督目标进行训练,和GPT一样,模型根据上文来预测当前词汇,最终训练得到的模型可以生成流畅的中文表达。

本次开源的中文文本预训练模型由40层Transformer组成,隐层维度2560,包含32个注意力头,共32亿参数。训练语料丰富多样,包括新闻、百科、散文等,文本生成能力强大。

中文预训练模型基础上还可以进行微调操作,充分利用少量有监督数据增强模型在下游任务上的表现,如文本分类,对话生成、古诗创作等;除此之外,中文预训练模型还能够实现简单的少样本学习,如下图所示,输入已知的部分样例,模型能够捕捉类似的规律进行文本生成。

text

安装与使用

具体安装步骤请参见text.

视觉预训练模型

模型介绍

show

现有的掩码语言模型的随机遮蔽方式容易对图像中重要的前景目标遮蔽,让模型产生误解,不利于快速收敛。然而,在无监督的情况下,如何自适应的调整遮蔽区域是一个非常关键的难点问题。为此,我们巧妙的利用Transformer中的自注意力机制,并且设计了一种动态掩码机制来对图像进行预训练。

具体来说,我们的视觉动态掩码机制采用teacher网络中最后的自注意力图作为指导,以一定的概率选择响应较低的区域对student网络的输入进行动态遮蔽

$\begin{equation} Attn = \frac{1}{H}\sum_{h=1}^{H} Softmax(Q_h^{cls}\cdot \frac{K_h^T}{\sqrt{d}}) \end{equation}$

$\begin{equation} m_i = \begin{cases} 1, & prob_i < p \\ and \\ Atten_i < \tau\\\\ 0, & otherwise \end{cases} \end{equation}$

相比BERT中MLM的随机遮蔽方式,动态遮蔽方式避免了破坏图像/目标的关键结构,而这些关键结构的遮蔽往往使得训练中的模型产生误解,降低预训练模型的关注度。下图展示了我们的动态掩码与随机掩码的区别,可以看出,通过动态掩码的方式,图像中目标的完整结构得以保留。

avatar

进一步,被遮蔽的局部块与剩余的局部块一起送入全局图像解码器,以恢复图像的完整结构。最后,我们的损失函数为对比损失+图像重建损失,两种损失都采用自监督的方式进行学习,并结合动态掩码机制,显示捕捉图像局部上下文信息并保留全图语义信息。图像解码器部分采用经典的特征金字塔结构,完美保留图像空间信息,因此对下游密集预测任务更加友好,无缝支持下游目标检测、语义分割任务的微调。

安装说明

具体安装步骤请参见vision.

目标检测结果展示

show

语义分割结果展示

show

注意力对比图

show show

语音预训练模型

模型介绍

语音预训练采用wav2vec2.0的自监督学习技术。

与BERT类似,wav2vec2.0是通过预测语音被掩盖部分(masked parts)的语音单元来完成建模任务的。

wav2vec 2.0 模型首先使用CNN网络提取原始音频信号的潜在特征表示。 这些表征向量被喂到量化器(quantizer)和transformer中。量化器从学习的码本(codebook)中选择一个量化语音单元。 一部分表征在输入transformer前会被掩盖,模型需要通过掩盖位置识别正确的量化语音单元。

基于wav2vec2.0的语音预训练技术能够学习的任务无关的优质的特征表示,在多种下游任务中都能获得良好的性能。 wav2vec2.0配合多任务学习方法进行训练得到的多任务通用语音模型能够很好的应用于各种场景。

speech_taichu

模型安装与使用

具体模型安装与使用示例请参考speech

轻量化图文预训练模型

模型介绍

现有的图文预训练模型主要针对英文文本描述进行图像生成,本次开源的图文预训练模型可以根据中文文本描述实现图像生成,采用千万级训练数据进行自监督训练,并通过知识蒸馏算法实现了模型的大幅度压缩,在尽可能保留模型性能的同时,实现了预训练模型的轻量化。

dalle_kd

轻量化图文预训练模型由DALL-E和CLIP两个模型组成,DALL-E模型由8层Transformer组成,隐层维度为512,包含32个注意力头,约1亿参数;CLIP模型由6层Vision Transformer和3层Transformer组成,Vision Transformer的隐层维度为256,包含16个注意力头,Transformer的隐层维度为192,包含12个注意力头,约1700万参数。

本次开源的图文预训练模型以8亿参数的DALL-E和4亿参数的CLIP大模型作为Teacher,1亿参数的DALL-E和1700万参数的CLIP作为Student进行知识蒸馏,针对Vision Transformer和Transformer输入的Embedding层、各层各个注意力头的Attention Score以及各层的输出进行蒸馏,与Student模型的训练损失一同进行优化,以实现大模型的信息向小模型的传递。具体损失如下:

$\begin{equation} L_{kd}(S_m,T_{g(m)}) = \begin{cases} L_{embed}(S_0, T_0), & m=0 \\\\ L_{hidn}(S_m,T_{g(m)}) + L_{attn}(S_m,T_{g(m)}) , & M \ge m \gt 0 \\\\ L_{pred} (S_{M+1},T_{N+1}) , & m = M + 1 \end{cases} \end{equation}$

$\begin{equation} L_{total} = \alpha_1 L_{kd} + \alpha_2 L_{student} \end{equation}$

轻量化图文预训练模型可以完成通用领域的中文文本图像生成任务,也可以在特定图像生成任务上进行微调,充分利用少量有监督数据增强模型在下游任务的表现,实现在下游任务的高效部署与应用。

模型安装与使用

具体模型安装与使用示例请参考light_vision_text

图像生成结果展示

avatar

图像检索结果展示

avatar

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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.

简介

暂无描述 展开 收起
Python
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/huang_1458729839/multi-modal-models.git
git@gitee.com:huang_1458729839/multi-modal-models.git
huang_1458729839
multi-modal-models
紫东太初多模态大模型
master

搜索帮助