This commit is contained in:
xxupiano 2021-09-18 10:51:06 +08:00
parent cfb7b1c987
commit 26e9b928cf
61 changed files with 26 additions and 18 deletions

View File

@ -34,25 +34,13 @@ git clone git@github.com:zjunlp/DeepKE.git
- `train.txt`:存放训练数据集
- `valid.txt`:存放验证数据集
- `test.txt`:存放测试数据集
- 开始训练:```python run.py``` (训练所用到参数都在conf文件夹中修改即可)
- 先进行训练,训练后的模型参数保存在`out_ner`文件夹中
```
python run.py --data_dir=data/ --bert_model=bert-base-cased --task_name=ner --output_dir=out_ner --max_seq_length=128 --do_train --num_train_epochs 5 --do_eval --warmup_proportion=0.1
```
- 再进行预测
- 执行以下命令运行示例`python predict.py`
- 如果需要指定NER的文本可以利用--text参数指定
````
python predict.py --text="It was one o'clock when we left Lauriston Gardens and Sherlock Holmes led me to Metropolitan Police Service.."
````
- 每次训练的日志保存在 `logs` 文件夹内,模型结果保存在 `checkpoints` 文件夹内。
- 进行预测 ```python predict.py```
## 模型内容
BERT

View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -65,7 +65,9 @@
"metadata": {},
"source": [
"## BERT\n",
"[**Bidirectional Encoder Representations from Transformers (BERT)**](https://github.com/google-research/bert) is a transformer-based machine learning technique for natural language processing (NLP) pre-training developed by Google."
"[**Bidirectional Encoder Representations from Transformers (BERT)**](https://github.com/google-research/bert) is a transformer-based machine learning technique for natural language processing (NLP) pre-training developed by Google.\n",
"\n",
"![BERT](img\\BERT.png)"
]
},
{
@ -894,7 +896,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -909,6 +911,24 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
"autoclose": false,
"autocomplete": true,
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"eqLabelWithNumbers": true,
"eqNumInitial": 1,
"hotkeys": {
"equation": "Ctrl-E",
"itemize": "Ctrl-I"
},
"labels_anchors": false,
"latex_user_defs": false,
"report_style_numbering": false,
"user_envs_cfg": false
}
},
"nbformat": 4,

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB