Model details
模型介绍 中文整理 SiameseUniNLU通用自然语言理解模型介绍
SiameseUniNLU通用自然语言理解模型,基于提示(Prompt)+文本(Text)的构建思路,通过设计适配于多种任务的Prompt,并利用指针网络(Pointer Network)实现片段抽取(Span Extraction),从而实现对命名实体识别、关系抽取、事件抽取、属性情感抽取、情感分类、文本分类、文本匹配、自然语言推理、阅读理解等多类自然语言理解任务的统一处理。和市面上已有的自然语言理解类模型不同的是:
*更通用**:UniNLU为各种理解类任务都设计了相应适配的Prompt,并通过大量训练,使得一个模型几乎可以解决所有自然语言理解类任务,支持的任务包括: 命名实体识别:抽取输入文本中的实体片段 关系抽取:抽取输入文本中具备特定关系类型的主客实体片段 事件抽取:抽取输入文本中相互联系的事件论元片段 属性情感抽取:抽取输入文本中特定对象的相关情感词片段 指代消解:判断给定代词是否指向文中的某一对象 情感分类:给定一段文本和候选情感标签,返回可以恰当表示该段文本情感倾向的标签 文本分类:给定一段文本和候选类别标签,返回可以恰当表示该段文本所属类别的标签 文本匹配:给定两段文本和相应相似度标签,返回可以恰当表示两段文本相似度的标签,文本相似度标签通常为“相似”,“不相似”两种 自然语言推理:给定两段文本和相应文本关系标签,返回可以恰当表示两段文本关系的标签,文本关系标签通常为“蕴含”,“矛盾”,“中立”三种 阅读理解:输入问题及参考文本,返回基于该段参考文本的问题答案,通常分为选择类阅读理解和抽取类阅读理解 *更高效**:UniNLU基于孪生神经网络的思想,将预训练语言模型(PLM)的前 N-n 层改为双流,后 n 层改为单流。我们认为语言模型的底层更多的是实现局部的简单语义信息的交互,顶层更多的是深层信息的交互,因此前N-n层不需要让Prompt和Text做过多的交互,我们将前N-n层Text的隐向量表示缓存了下来,从而将**推理速度提升了30%**; *更精准**:我们在10类任务、6个领域、15个数据集上进行了测试 模型描述
模型基于structbert-base-chinese在千万级远监督数据+有监督数据预训练得到,模型框架如下图:
期望模型使用方式以及适用范围
你可以使用该模型,实现命名实体识别、关系抽取、事件抽取、属性情感抽取、指代消解、情感分类、文本分类、文本匹配、自然语言推理、阅读理解等各类信息抽取任务。
如何使用
安装Modelscope
依据ModelScope的介绍,实验环境可分为两种情况。在此推荐使用第2种方式,点开就能用,省去本地安装环境的麻烦,直接体验ModelScope。
1 本地环境安?
可参考ModelScope环境安装。
2 Notebook
ModelScope直接集成了线上开发环境,用户可以直接在线训练、调用模型。
打开模型页面,点击右上角“在Notebook中打开”,选择机器型号后,即可进入线上开发环境。
代码范例
Fine-Tune 微调示例
零样本推理示例
模型局限性以及可能的偏差
模型在较冷门的场景,效果可能不及预期。
相关论文以及引用信息
优先采用原作者提供的中文模型卡片;仅有英文说明时由闲社AI翻译整理。重要参数、许可证和商用范围请以原文为准。
你将获得什么 完整仓库方式包含该固定版本中的权重、配置、分词器及说明文件;指定版本方式只下载所选文件或整组分片。多模态模型的投影文件、配置等依赖,请按作者说明配齐。
完整仓库可能包含多个权重格式,因此需要的磁盘空间可能大于单一格式的模型大小。下载文件不等于完成模型部署。
使用前须知 运行环境 运行模型需要的设备、工具与依赖,以原作者说明为准。
授权范围 是否允许商用、修改和分发,请查看模型许可证。
闲社提供资料与镜像下载方法,不代表已运行模型或完成安全审计。下载的代码应先检查,再执行。
Problem with the information or download? Sign in to submit feedback.
Pinned version · Multiple download options
nlp_structbert_siamese-uninlu_chinese-base model download Download the full repository or choose a version or file.
Choose a download source ModelScope · China direct
Pinned ModelScope version: 2c69c38c2e2ba38c00ba9503e20a19def27ee629. Version identifiers can differ across sites. The alternative source was provided after checking weights and runtime configuration; this is not proof of a successful model run.
A checked, pinned ModelScope source is available for this model. Use the ModelScope download tool.
Choose what to download
Full repository · All files Selected version / file
Need just one GGUF precision? Load the file manifest and choose a version. Direct file links do not require Python; the command below can download multiple shards together.
Load available versions and files
Quantization / file Load the manifest to choose
This reads the pinned version's file manifest; no model weights are downloaded.
Choose your operating system Windows · PowerShell Linux / macOS · Terminal
For command-line downloads, follow these steps to get the full repository or selected files. Direct file links do not need these steps.
1 Open a terminal window Create and open a folder for the model. In the folder's address bar, enter powershell and press Enter.
If Python is not installed, get it from the official Python website . In the terminal, enter python --version; continue when a version number appears.
2 First time? Install the download tool Copy this command, paste it into the terminal, press Enter and wait for installation to finish.
python -m pip install --upgrade huggingface_hubCopy install command Already installed? Continue to step 3.
3 Run the download command Select the button below, paste into the same terminal and press Enter. The tool downloads all files included in the current command.
Copy full download command
Copying does not start a download. Paste and run the command on your device.
Where are the downloaded files? Open the folder you chose. Look for the models folder. When progress stops and the terminal returns to its prompt without errors, check that all files are present. 'Copied' does not mean 'downloaded'.
No response or an error? python not found: Install Python and reopen the terminal. On Windows, follow the installer's instructions to enable command-line access.
hf not found: Confirm that step 2 succeeded, then reopen the terminal. If needed, add Python's Scripts folder to your user PATH. Do not repeatedly download scripts.
Network interrupted: Stay in the same folder and run the same command again. The tool checks existing files.
Permission or disk error: Choose a writable folder with enough free space. Do not disable system security protection.
View the full download command
请开启浏览器脚本,或使用默认 Windows 教程并展开命令手动复制执行。