ZEN2 model, which uses N-gram to enhance text semantic and has 668M parameters, is adept at NLU tasks.
我们与
ZEN团队合作,使用我们的封神框架,开源发布了ZEN2模型。具体而言,通过引入无监督学习中提取的知识,ZEN通过N-gram方法学习不同的文本粒度信息。ZEN2使用大规模数据集和特殊的预训练策略对N-gram增强编码器进行预训练。下一步,我们将继续与ZEN团队一起探索PLM的优化,并提高下游任务的性能。
We open source and publicly release ZEN2 using our Fengshen Framework in collaboration with the
ZEN team. More precisely, by bringing together knowledge extracted by unsupervised learning, ZEN learns different textual granularity information through N-gram methods. ZEN2 pre-trains the N-gram-enhanced encoders with large-scale datasets and special pre-training strategies. In the next step, we continue with the ZEN team to explore the optimization of PLM and improve the performance on downstream tasks.
因为
transformers库中是没有ZEN2相关的模型结构的,所以你可以在我们的
Fengshenbang-LM中找到并且运行代码。
Since there is no structure of ZEN2 in
transformers library, you can find the structure of ZEN2 and run the codes in
Fengshenbang-LM.
1from fengshen.models.zen2.ngram_utils import ZenNgramDict
2from fengshen.models.zen2.tokenization import BertTokenizer
3from fengshen.models.zen2.modeling import ZenForSequenceClassification, ZenForTokenClassification
4
5pretrain_path = 'IDEA-CCNL/Erlangshen-ZEN2-668M-Chinese'
6
7tokenizer = BertTokenizer.from_pretrained(pretrain_path)
8model_classification = ZenForSequenceClassification.from_pretrained(pretrain_path)
9model_extraction = ZenForTokenClassification.from_pretrained(pretrain_path)
10ngram_dict = ZenNgramDict.from_pretrained(pretrain_path, tokenizer=tokenizer)
11
You can get classification and extraction examples below.
If you are using the resource for your work, please cite the our paper for this model:
1@article{Sinovation2021ZEN2,
2 title="{ZEN 2.0: Continue Training and Adaption for N-gram Enhanced Text Encoders}",
3 author={Yan Song, Tong Zhang, Yonggang Wang, Kai-Fu Lee},
4 journal={arXiv preprint arXiv:2105.01279},
5 year={2021},
6}
如果您在您的工作中使用了我们的模型,也可以引用我们的
总论文:
If you are using the resource for your work, please cite the our
overview paper:
1@article{fengshenbang,
2 author = {Jiaxing Zhang and Ruyi Gan and Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen},
3 title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
4 journal = {CoRR},
5 volume = {abs/2209.02970},
6 year = {2022}
7}
1@misc{Fengshenbang-LM,
2 title={Fengshenbang-LM},
3 author={IDEA-CCNL},
4 year={2021},
5 howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
6}