wangpeiyi9979 / esd Goto Github PK
View Code? Open in Web Editor NEWCode for NAACL2022 Long Paper "An Enhanced Span-based Decomposition Method for Few-Shot Sequence Labeling"
Code for NAACL2022 Long Paper "An Enhanced Span-based Decomposition Method for Few-Shot Sequence Labeling"
Hi, peiyi. I have a detailed question about CSA.
It seems that we can directly use this to compute that does not need loop:
support_span_enhance4one_query = self.cross_attentioner(support_span_rep.unsqueeze(0),
one_query_spans_squeeze.unsqueeze(0),
one_query_spans_squeeze.unsqueeze(0)).squeeze(0)
query_span_enhance_rep = self.cross_attentioner(one_query_spans_squeeze.unsqueeze(0),
support_span_rep.unsqueeze(0),
support_span_rep.unsqueeze(0)).squeeze(0)
And it seems that the implementation is different from paper.
I don't know if there is something wrong with my understanding.
Hi! I have a detailed question that the code prints
Batch f1 [ SNIPS ]: [Beam Soft Nms]: ( p: {:.4f}; r: {:.4f}; f1: {:.4f} ) beam_size :{} k:{}, u:{}, delta:{}
Batch f1 [ SNIPS ]: [Origin ]: ( p: {:.4f}; r: {:.4f}; f1: {:.4f} )
All f1 [FewNERD]: [Beam Soft Nms]: ( p: {:.4f}; r: {:.4f}; f1: {:.4f} ) beam_size :{} k:{}, u:{}, delta:{}
All f1 [FewNERD]: [Origin ]: ( p: {:.4f}; r: {:.4f}; f1: {:.4f} ).
What does this mean? I guess that:
If I use SNIPS dataset, I can get the results through the corresponding Batch F1. If I use FewNERD dataset, I can get the results through the corresponding All F1. Is my guess correct? Thanks.
您好!我发现span这个变量里,一个句子中总是把它正确的槽标签起始位置放在前面,后面才是枚举了一些别的span。那在进行预测的时候,在计算增强后的span representation,以及每类的原型向量,不就相当于已经提前知道了query set的正确的槽边界,并且利用它来计算了representation,后面才进行span的分类?就是指query set虽然不知道槽的类别,但是它提前得到了边界信息。不知道我有没有理解错,期待您的回复
①if self.is_support == False:
tag = tag - self.opt.O_class_num + 1 # for query, O1, O2, O3 -> O, entity_tag -> entity_tag - 2
请问这里,为什么要减2啊?之前根据support set,得到了tag2label, label2tag。这两个字典,就是下标和槽名的一一对应,那query set里获取tag的时候,减2不会把这个对应关系搞混吗?
②上面那两句代码的下一行,gold_entitys.add((b, e - 1, tag))。请问这里为什么还要减1?在函数 get_entity里,
if end_of_chunk(prev_tag, tag, prev_type, type_):
chunks.append((prev_type, begin_offset, i-1))
此处加到chunks里的,不是已经i-1了吗?
期待您的解答,谢谢
Hi, peiyi.
I have two detailed questions about paper and code:
query_out = self.word_encoder(query['word'], query['word'] != 0,output_hidden_states=True, return_dict=True)
Line 7 in d2c8924
在处理含有不同数目span的句子时,您是较少的span数目句子添加pad,然后再统计那些span是pad。
比如当前句子有12个span,batch句子中最大span数是14,那么就会把12个扩充成14个,最后2个是0。
然而这个函数在标记0的位置时,用“>”判断,utils.py第16行,是否应该换成">="呢,因为
seq_range_expand = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13]
seq_length_expand = [12,12,12,12,12,12,12,12,12,12,12,12,12,12]
如果用“>”,会少标记一个0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.