初始化项目,由ModelHub XC社区提供模型
Model: Fengshenbang/Wenzhong-GPT2-110M-chinese-v2 Source: Original Platform
This commit is contained in:
32
.gitattributes
vendored
Normal file
32
.gitattributes
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||
*.tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
*.db* filter=lfs diff=lfs merge=lfs -text
|
||||
*.ark* filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
|
||||
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
|
||||
118
README.md
Normal file
118
README.md
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
language:
|
||||
- zh
|
||||
license: Apache License 2.0
|
||||
|
||||
tags:
|
||||
- generate
|
||||
- gpt2
|
||||
|
||||
tasks:
|
||||
- text-generation
|
||||
|
||||
model_type:
|
||||
- GPT2
|
||||
|
||||
domain:
|
||||
- nlp
|
||||
|
||||
frameworks:
|
||||
- pytorch
|
||||
|
||||
backbone:
|
||||
- transformer
|
||||
|
||||
widgets:
|
||||
- task: text-generation
|
||||
examples:
|
||||
- name: 1
|
||||
inputs:
|
||||
- data: 西湖的景色
|
||||
- name: 2
|
||||
inputs:
|
||||
- data: 北京是中国的
|
||||
|
||||
---
|
||||
|
||||
# Wenzhong-GPT2-110M
|
||||
|
||||
- Github: [Fengshenbang-LM](https://github.com/IDEA-CCNL/Fengshenbang-LM)
|
||||
- Docs: [Fengshenbang-Docs](https://fengshenbang-doc.readthedocs.io/)
|
||||
|
||||
## 简介 Brief Introduction
|
||||
|
||||
善于处理NLG任务,中文版的GPT2-Small。
|
||||
|
||||
Focused on handling NLG tasks, Chinese GPT2-Small.
|
||||
|
||||
## 模型分类 Model Taxonomy
|
||||
|
||||
| 需求 Demand | 任务 Task | 系列 Series | 模型 Model | 参数 Parameter | 额外 Extra |
|
||||
| :----: | :----: | :----: | :----: | :----: | :----: |
|
||||
| 通用 General | 自然语言生成 NLG | 闻仲 Wenzhong | GPT2 | 110M | 中文 Chinese |
|
||||
|
||||
## 模型信息 Model Information
|
||||
|
||||
类似于Wenzhong2.0-GPT2-3.5B-chinese,我们实现了一个small版本的12层的Wenzhong-GPT2-110M,并且在悟道(300G版本)上面进行预训练。
|
||||
|
||||
Similar to Wenzhong2.0-GPT2-3.5B-chinese, we implement a small size Wenzhong-GPT2-110M with 12 layers, which is pre-trained on Wudao Corpus (300G version).
|
||||
|
||||
## 使用 Usage
|
||||
|
||||
```python
|
||||
# load 模型
|
||||
from transformers import GPT2Tokenizer,GPT2LMHeadModel
|
||||
hf_model_path = 'IDEA-CCNL/Wenzhong-GPT2-110M' # 或者此处为modelscope git clone下载后的模型路径
|
||||
tokenizer = GPT2Tokenizer.from_pretrained(hf_model_path)
|
||||
model = GPT2LMHeadModel.from_pretrained(hf_model_path)
|
||||
model.eval()
|
||||
# 模型推理
|
||||
question = "北京是中国的"
|
||||
inputs = tokenizer(question,return_tensors='pt')
|
||||
generation_output = model.generate(**inputs,
|
||||
return_dict_in_generate=True,
|
||||
output_scores=True,
|
||||
max_length=150,
|
||||
# max_new_tokens=80,
|
||||
do_sample=True,
|
||||
top_p = 0.6,
|
||||
# num_beams=5,
|
||||
eos_token_id=50256,
|
||||
pad_token_id=0,
|
||||
num_return_sequences = 5)
|
||||
|
||||
for idx,sentence in enumerate(generation_output.sequences):
|
||||
print('next sentence %d:\n'%idx,
|
||||
tokenizer.decode(sentence).split('<|endoftext|>')[0])
|
||||
print('*'*40)
|
||||
|
||||
```
|
||||
|
||||
## 引用 Citation
|
||||
|
||||
如果您在您的工作中使用了我们的模型,可以引用我们的[论文](https://arxiv.org/abs/2209.02970):
|
||||
|
||||
If you are using the resource for your work, please cite the our [paper](https://arxiv.org/abs/2209.02970):
|
||||
|
||||
```text
|
||||
@article{fengshenbang,
|
||||
author = {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 and Ruyi Gan and Jiaxing Zhang},
|
||||
title = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
|
||||
journal = {CoRR},
|
||||
volume = {abs/2209.02970},
|
||||
year = {2022}
|
||||
}
|
||||
```
|
||||
|
||||
也可以引用我们的[网站](https://github.com/IDEA-CCNL/Fengshenbang-LM/):
|
||||
|
||||
You can also cite our [website](https://github.com/IDEA-CCNL/Fengshenbang-LM/):
|
||||
|
||||
```text
|
||||
@misc{Fengshenbang-LM,
|
||||
title={Fengshenbang-LM},
|
||||
author={IDEA-CCNL},
|
||||
year={2021},
|
||||
howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
|
||||
}
|
||||
```
|
||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"activation_function": "gelu_fast",
|
||||
"architectures": [
|
||||
"GPT2LMHeadModel"
|
||||
],
|
||||
"attn_pdrop": 0.1,
|
||||
"bos_token_id": 50256,
|
||||
"embd_pdrop": 0.1,
|
||||
"eos_token_id": 50256,
|
||||
"initializer_range": 0.02,
|
||||
"layer_norm_epsilon": 1e-05,
|
||||
"model_type": "gpt2",
|
||||
"n_ctx": 1024,
|
||||
"n_embd": 768,
|
||||
"n_head": 12,
|
||||
"n_inner": 3072,
|
||||
"n_layer": 12,
|
||||
"n_positions": 1024,
|
||||
"reorder_and_upcast_attn": false,
|
||||
"resid_pdrop": 0.1,
|
||||
"scale_attn_by_inverse_layer_idx": false,
|
||||
"scale_attn_weights": true,
|
||||
"summary_activation": null,
|
||||
"summary_first_dropout": 0.1,
|
||||
"summary_proj_to_labels": true,
|
||||
"summary_type": "cls_index",
|
||||
"summary_use_proj": true,
|
||||
"tokenizer_class": "GPT2TokenizerFast",
|
||||
"transformers_version": "4.12.3",
|
||||
"use_cache": true,
|
||||
"vocab_size": 50304
|
||||
}
|
||||
8
configuration.json
Normal file
8
configuration.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"task": "text-generation",
|
||||
"framework": "pytorch",
|
||||
"pipeline": {
|
||||
"type": "text-generation",
|
||||
"model_revision": "v0.1"
|
||||
}
|
||||
}
|
||||
50001
merges.txt
Normal file
50001
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:89b89031fda7e910628b3813b43d829b24d1c641941dff9d797ae0e5fd18f1da
|
||||
size 274169513
|
||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
||||
{"bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "unk_token": "<|endoftext|>"}
|
||||
1
tokenizer.json
Normal file
1
tokenizer.json
Normal file
File diff suppressed because one or more lines are too long
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"unk_token": "<|endoftext|>", "bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "add_prefix_space": false, "model_max_length": 1024, "special_tokens_map_file": null, "name_or_path": "gpt2", "tokenizer_class": "GPT2Tokenizer"}
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user