Giter VIP home page Giter VIP logo

biaffinedependencyparsing's Introduction

BiaffineDependencyParsing

BERT+Transformer+Biaffine dependency parser

Update

[2020-04-23] 修复数据加载中一个bug,在use_cache=True时可大幅度缩短数据加载准备耗时

Result

metrics

以上结果均为在Semeval-2016-Test集上测试得到的LAS

详细结果见: metrics记录

Semeval-2016 Task9数据集

原始评测数据集:HIT-SCIR/SemEval-2016: SemEval-2016 Task 9: Chinese Semantic Dependency Parsing

原始数据集格式不符合conllu格式,你也可以使用我们处理过后的数据集,或者使用脚本自己处理

数据集处理完成之后需要在yaml配置文件中写入,例如:

data_set:

data_dir: 'dataset/sem16'

train_file: 'train/text_news.train.conllu'

dev_file: 'dev/sdp_news_dev.conllu'

test_file: 'test/sdp_news_test.conllu'

同时根据数据集的相关信息合理设置per_gpu_train_batch_sizemax_seq_len等参数

使用

训练Train

查看帮助信息:python main.py train -h

CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py train -c config_files/bert_biaffine.yaml

torch.distributed 分布式训练

distributedDataParallel VS dataParallel

当GPU卡数较多或数据量较大(或者max_seq_len较大时),推荐使用torch.distributed训练

CUDA_VISIBLE_DEVICES=0,1,2,3,5,6 python -m torch.distributed.launch --nproc_per_node=6 main.py -c config_files/bert_biaffine.yaml

验证Dev

查看帮助信息:python main.py dev -h

CUDA_VISIBLE_DEVICES=0 python main.py dev -m <模型保存路径> -i <输入gold conllu文件> -o <输出文件>

推理Inference

查看帮助信息:python main.py infer -h

CUDA_VISIBLE_DEVICES=0 python main.py infer -m <模型保存路径> -i <输入conllu文件> -o <输出文件>

References

[1] Ding, Y., Shao, Y., Che, W., Liu, T., 2014. Dependency Graph Based Chinese Semantic Parsing, in: Sun, M., Liu, Y., Zhao, J. (Eds.), Chinese Computational Linguistics and Natural Language Processing Based on Naturally Annotated Big Data, Lecture Notes in Computer Science. Springer International Publishing, Cham, pp. 58–69. https://doi.org/10.1007/978-3-319-12277-9_6

[2] Wang, Y., Che, W., Guo, J., Liu, T., 2018. A Neural Transition-Based Approach for Semantic Dependency Graph Parsing, in: AAAI.

[3] Dozat, T., Manning, C.D., 2018. Simpler but More Accurate Semantic Dependency Parsing, in: Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers). Presented at the ACL 2018, Association for Computational Linguistics, Melbourne, Australia, pp. 484–490. https://doi.org/10.18653/v1/P18-2077

[4] Li, Y., Li, Z., Zhang, M., Wang, R., Li, S., Si, L., 2019. Self-attentive biaffine dependency parsing, in: IJCAI International Joint Conference on Artificial Intelligence. pp. 5067–5073. https://doi.org/10.24963/ijcai.2019/704

[5] Kondratyuk, D., Straka, M., 2019. 75 Languages, 1 Model: Parsing Universal Dependencies Universally. pp. 2779–2795. https://doi.org/10.18653/v1/d19-1279

相关项目:

biaffinedependencyparsing's People

Contributors

liangsli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

biaffinedependencyparsing's Issues

where is the graph_vocab.txt ?

thanks you for your great code. I wonder where is the graph_vocab.txt file or how can i generate the file to reprocuce your experiment,

在处理中英文混合文本时,每个word对应的start_pos, end_pos的处理有错误?

在_get_words_start_end_pos函数中,是根据len(w)的叠加来递增start_pos和end_pos的。但是,当w是英文时,bert是采用wordPieces算法分词的,而不是按字母来分词的。这会导致 _get_words_start_end_pos中的w的长度(e.g. len('15*9mm')=6) 与 convert_examples_to_features 中w的长度(e.g. len([ 15, *, 9, #mm ])=4)不一致。
因此,在数据处理阶段的start_pos和end_pos就是有问题的。
也有可能是我分析错了。请帮忙看一看。
@LiangsLi

Is there any plan to share paper or tutorial ?

Hi,
I'm really interested in your work and I have recently worked at using BERT to do parsing,
But I am a little fresh about how to deal with the tokenizing and the decoding,

So do you have any plan to release a paper or do any tutorial?

vocab.txt来源

您好 请问 bertology_loader.py下面的vocab.txt文件怎么来的
assert (pathlib.Path(args.saved_model_path) / 'vocab.txt').exists()

请教关于bert如何encoding的几个问题

1、bert作为pre-trained的embedding,参与整个模型的fine-tune吗?
2、从bert的token embedding,到 biaffine之前的word embedding,是怎么转换的?怎么从token转到wod?
3、为什么在bert之后还要加transformer?bert里面已经是L个transformer encoder层了。
谢谢。@LiangsLi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.