Code Monkey home page Code Monkey logo

k-bert's People

Contributors

autoliuweijie 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

k-bert's Issues

基于模型预测

您好,请教您一个问题,怎样基于训练好的模型bin文件,加载模型进行交互识别呢?

关于knowledge Graph data 自动产生

作者你好我想请问关于像是HowNet.spo这种资料如果在我的任务上没有相关资料是否有办法自动产生呢?
像这种Entity Relation Entity自动产生的方法作者有没有参考过相关的论文或作法呢

谢谢

evaluate 时不考虑 token entity 正确性

你好,想请问一下我发现你的 NER 在计算 F1 的时候似乎只有考虑 token 的位置正确性( line 332) 但没有判断 entity 的分类正确性。我的理解是正确吗?

for entity in pred_entities_pos: if entity not in gold_entities_pos: continue else: correct += 1

Ask for help about your article

Dear Dr.Liu:
I am a master's student at ISCAS, My research is focused on EMR information extraction. I have recently read your paper "K-BERT: Enabling Language Representation with Knowledge Graph" and got a lot of inspiration from it, thank you!
I am wondering if you could kindly send me the slides for presentation or other materials about it. I promise they will be used only for research purposed.
My email:[email protected]
Yours sincerely,
Wenwen Xu

About our BERT

您好
请问是否能公开您们在论文实验中所谓的our BERT呢? 谢谢
Inked擷取_LI

知识的融入与大规模语料

您好,看到在以前的讨论Issue2中提到了关于k-bert在一些任务上效果不显著的问题。其中第二点提到

知识图谱的质量不高,目前我们的知识图谱大多从开放领域图谱中筛选的,其中的知识BERT通过大规模语料预训练也能得到。

1 怎样的知识是比较适合在k-bert场景中引入的?
2 我理解获取大规模语料应该比获取知识的成本要低,如果模型通过大规模的语料预训练也能得到知识的话,那么通过如k-bert这样的方式引入知识的具体意义 或者说 适用场景在哪里?

Where is the NLPCC-DBQA?

Hi, I am interested in this paper, while I can not find the NLPCC-DBQA dataset from your source codes. Could you show the results of the NLPCC-DBQA from your codes? Thanks.

消融实验相关问题

您好,我就着您的框架做了一些实验,效果都很不错。不过对知识所起的作用有一些不同理解,我做的实验结果显示并非有助于句子理解的知识起到的作用效果更好,因此我对kbert的起作用的机制有一些其他推测,您如果有兴趣可以详细探讨一下。想问您有相关消融实验数据么,软位置,可见矩阵等哪个机制起到了作用呢。谢谢

关于结果的随机性

同学您好,感谢分享您的工作,想请教一下指定了随机种子后(默认是seed=7),训练的结果(包括每一步的损失和ACC)还是有一定的随机性,这是为什么呢?

pytorch 转 tensorflow

autoliuweijie您好:
这个模型可以转为tensorflow格式或者有tensorflow版吗?主要是对比实验需要用您这个模型。
谢谢!

Prediction

I have run the run_kbert_ner.py script with the Medicine_NER data. I have obtained the fine-tuned model. However, I was wondering to do the inference to obtain the prediction. I have seen in the UER repository, that there is an additional folder with the inference scripts "inference/run_ner_infer.py"
How does this work for your code?

Target of soft position index and visible matrix

Hi~
通过soft position index和visible matrix来保持同质embedding空间,避免知识噪音的做法真的是巧妙,但是我有一个疑问,如果把input sentence里面的entity在知识库里找到之后不做soft position index和visible matrix的变换,而是直接转换为几个句子,其中包含原始的input sentence和找到的entity对应到知识库中的句子,然后一句一句的输入到bert中去fine tune的话,是不是也可以达到知识注入的效果呢?并且因为是每个知识都转换成了独立的句子,对应于bert里的hard position index, 这样做会有什么问题吗?请指教,谢谢~

关于知识噪声的问题

你好,我发现K-bert目前的entity linking的方式比较直接,并不会对有多种含义的实体进行区别,在实际使用过程中这往往会带来噪声,特别是一些大的知识库,有高频词带低频标签的情况。
比如用到过一个百科知识库里,有 舒适 → 作家名 这样的实体映射,也有大量一词多义的现象,单纯从word matching选择实体很容易将大量的噪声带入。
在实际使用中我发现特别是inference过程,大量是因为这类噪声知识的引入,反而让模型错判。

1 针对目前直接查表的entity linking,请问有没有合适的降噪思路?
2 我看到作者提到“知识驱动”型任务,在微观层面是对每个识别的实体判断是否需要引入知识,请问这方面有没有什么思路或者可以借鉴的前沿研究可以参考?
比如早年比较火的attention机制,有没有可能引入类似selective attention的方法,来判断实体是否应该挂载知识以及挂载哪个知识,这类思路和k-bert的知识挂载方式有没有结合点?

您好

请问提供K-Bbert的预训练模型嘛

About Knowgraph.py

您好,请问Knowgraph.py中add_knowledge_with_vm函数通过pkseg分词得到的是每个字而不是单词,而brain知识图谱中的实体都是词组,这样不是匹配不上吗?

如:
['[CLS]两小时读完']
[['[CLS]', '两', '小', '时', '读', '完', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', '[PAD]', ...

About the bin File

您好,

您的论文和idea真的令人印象深刻!

有过一个问题想要请教您。

我尝试用您的framework load 我自己的model的时候,是会报错的。

我看了您之前的回答,您对您的bin文件是做了一定的修改

想问下,您对您的bin文件做了怎样的修改呢?

麻烦您了

About lcqmc with HowNet

請問有已經訓練好的lcqmc with HowNet 模型可以公開嗎?
因為我嘗試利用KG HowNet 做在lcqmc 資料集上都無法訓練得跟論文中的數據一樣好

謝謝

关于CNDBpedia.spo的制作

你好,我想请教一下CNDBpedia.spo这个三元组的制作方式?我使用您共享的文件里面的词语进行检索,会出现多个关系组,请问您是根据什么规则进行过滤的呢?还有就是使用CNDBpedia.spo的网站提供的API是否需要申请apiKey以获得大规模调用的功能?

KBERT中 样本挂载知识的理解

Hi,
您好,KBERT的构思非常巧妙,最近使用这套框架做了一系列的实验。中间有关于K-BERT的疑问,想向您探讨咨询一下:
从代码看到,KBERT在训练和inference两个过程里都会将知识挂载到训练样本上,训练(或者说finetune)过程中把知识挂载上去,我理解有两种可能的作用:
第一种是让模型“学习”这些带有知识的训练样本,从而让知识被模型学到。
第二种是让模型学习到可以在训练样本上挂在知识这件事情,从而在inference的时候,模型可以有效的handle这些挂载了知识的训练样本。

从论文推断我理解作者应该是第一种情况。
那么,理论上因为模型已经通过样本学习到了知识,是否在inference时,不挂载知识而采用普通样本,模型也能inference出相对更好的效果?

dbpedia

if there is any source about dbpedia.spo(in english not CnDbpedia) ,thanks!

QA Model?

WIll Question Answering code be released? If so, when?

关于论文的可视矩阵

论文的图2中,可视矩阵是否有问题呀?
下文中对可视的情况进行了说明,在同一个分支为可视;否则不可视。
那么图2中,1为什么能看到4?4为什么能看到1?

关于pretrained model

不好意思,想请教您一下
有一个huggingface的pretrained model, 我在跑您的模型之前,已经用convert_bert_from_huggingface_to_uer的script做了转换,但每次都是报这么个错误,研究很久,实在没明白为什么。。

中文和英文的pretrained model我都试过,都是从google官网上重新下载的,但都是提示相同的错误。

就想跟您请教下,您对您的bin文件还做了其他修改么?
Screenshot_20200420070602

真的麻烦您了,谢谢

错误求教:在导入文本时代码为什么能直接把数据的label直接用int进行强制类型转换?

Vocabulary file line 344 has bad format token
Vocabulary Size: 21128
[BertClassifier] use visible_matrix: True
[KnowledgeGraph] Loading spo from /home/schen/K-BERT/brain/kgs/Medical.spo
Start training.
Loading sentences from ./datasets/medical_ner/train.tsv
There are 6919 sentence in total. We use 1 processes to inject knowledge into sentences.
{'text_a': 0, 'label': 1}
Progress of process 0: 0/6919
['山 , 男 , 7 3 岁 , 汉 族 , 已 婚 , 现 住 双 滦 区 陈 栅 子 乡 太 阳 沟 村 。', 'O O O O O O O O O O O O O O O O O O O O O O O O O O O O']

Traceback (most recent call last):
File "run_kbert_cls.py", line 582, in
main()
File "run_kbert_cls.py", line 501, in main
trainset = read_dataset(args.train_path, workers_num=args.workers_num)
File "run_kbert_cls.py", line 329, in read_dataset
dataset = add_knowledge_worker(params)
File "run_kbert_cls.py", line 84, in add_knowledge_worker
label = int(line[columns["label"]])
ValueError: invalid literal for int() with base 10: 'O O O O O O O O O O O O O O O O O O O O O O O O O O O O'

关于您给的google_models.bin

请问您给的下载链接中的google_models.bin预训练模型,是您自己训练的,还是谷歌官方的版本呢?
万分感谢!

中文字符的soft position

博主好:
看到你的文章有一些思考, 中文状态下, apple就是苹果, china就是**, 而bert的输入是字符级别的,那么在做soft position的时候, 苹果和**, 属于同一个索引还是分开索引, 分开索引的话visible matric应该怎么构建, 谢谢.

Fine-tune on English Corpus

I use Bert (model and tokenizer) to change K-BERT to the English version K-BERT. However, I got poor scores on the classification tasks. If you have K-BERT code of fine-tuning on English Corpus, could you please release it?

book_review数据集复现效果不佳

您好,感谢您开源代码,我使用您的代码和您分享的book_review数据集进行试验,但是准确率只有79%,比您的结果低了快10个百分点。想问问您有没有什么建议呢?
我的运行指令为:nohup python3 -u run_kbert_cls.py --train_path /data/book_review/train.tsv --dev_path /data/book_review/dev.tsv --test_path /data/book_review/test.tsv --epochs_num 5 --batch_size 32 --kg_name CnDbpedia --output_model_path ./outputs/kbert_bookreview_CnDbpedia.bin > ./outputs/kbert_bookreview_CnDbpedia.log &
(谷歌预训练模型和词表等文件路径我在程序中指定,max_length是默认的256)
我的结果为:79%
image

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.