powerycy / efficient-globalpointer Goto Github PK
View Code? Open in Web Editor NEWpytorch Efficient GlobalPointer
pytorch Efficient GlobalPointer
如题。“尝试在英文数据集下进行训练,比如ConLL2003,换用了预训练模型,将chinese_roberta_wwm_ext, 更改为Roberta(https://huggingface.co/FacebookAI/roberta-base)。同时也看到苏神原文中也有描述
“jemmeryl
November 22nd, 2022
请问大佬,这个模型在英文数据集上做实验时,因为英文会对单词进行分词,比如原本的实体['mr.', 'lippens']会变成['mr', '.', 'lip', '##pen', '##s'],那token_start_index和token_end_index计算时要怎么计算呢
回复评论
苏剑林 发表于 November 23rd, 2022
你这个问题是有问题的,我回答不了。
如果你用的BERT,那么原本的实体就是['mr', '.', 'lip', '##pen', '##s'],没有“原本的实体['mr.', 'lippens']”这种说法。先选定tokenizer,然后得到tokens,然后才去构造标签,这是很自然的顺序。标签不是与生俱来的,也不是天上掉下来的,是根据你的tokens来构造的。
回复评论”
是否因为英文分词而无法适配?或者需要将分词后的结果完成原词映射转换才行?
self.linear_1 = nn.Linear(hidden_size,hidden_size * 2,bias=True) self.linear_2 = nn.Linear(hidden_size * 2,heads * 2,bias=True)
这似乎与苏神的不一样吧?苏神的是
self.dense_1 = Dense( units=self.head_size * 2, use_bias=self.use_bias, kernel_initializer=self.kernel_initializer ) self.dense_2 = Dense( units=self.heads * 2, use_bias=self.use_bias, kernel_initializer=self.kernel_initializer )
第一个全连接层您的输出是hidden_size * 2
,苏神的是head_size * 2
您好,我拉了您的代码在3090上跑,参数不变,验证集最好的F1值只有0.65277,比您的少了一个点
176行 bias = torch.einsum('bnh -> bhn', self.linear_2(inputs)) / 2
这里最后除2是基于什么考虑的呢?
代码里看到的
Efficient-GlobalPointer/model/model.py
Line 167 in 827bcfa
cos_pos = pos[...,1::2].repeat(1,1,2))
sin_pos = pos[...,::2].repeat(1,1,2))
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.