wzzzd / pretrain_bert_with_masklm Goto Github PK
View Code? Open in Web Editor NEW使用Mask LM预训练任务来预训练Bert模型。训练垂直领域语料的模型表征,提升下游任务的表现。
使用Mask LM预训练任务来预训练Bert模型。训练垂直领域语料的模型表征,提升下游任务的表现。
您好,我想使用单机多卡训练,但是多卡不生效,只有1张卡会被使用,配置如下
self.mode = 'train'
self.cuda_visible_devices = '0,1,2,3' # 可见的GPU
self.device = 'cuda' # 这里改成cuda:0 也是同样不生效
self.port = str(random.randint(10000,60000)) # 多卡训练进程间通讯端口
self.init_method = 'tcp://localhost:' + self.port # 多卡训练的通讯地址
self.world_size = 1 # 线程数,默认为1
执行命令:python main.py
请教一下,是哪里配置的不对吗?
Can I transfer to TF?
请教一下,如果要使用个人搜集的中文数据集进行wwm预训练,
最近我在做一个垂直域预训练的技术储备,看了你DataManager里面的代码,但是没有能够理解wwm的实现方法,比如如何分词确定词语的边界。我以为是先使用分词器做的分词然后做的Masking操作。
我之前有了解过pkuseg分词器:https://github.com/lancopku/pkuseg-python
它不光可以确定词边界而且还能给出每个词的词性,感觉做masking的时候如果可以更大概率的去Mask实词,少一些放在虚词上应该效果会更好,欢迎探讨。wechat:yiyaoh
请问,自己的数据集需要什么特殊处理吗,直接扔进去中文原始文章是可以的吗?期待您的指教!
datasets里面train.txt和test.txt里面的文本有UNK标识,导致训练的时候金标准和训练样本一致,结果就是最后训练出来的模型我用来预测[MASK]的时候发现,出来的都是[MASK]。。
断点打在train.py第70行位置,watch一下list(zip(batch['input_ids'][0].tolist(), batch['labels'][0].tolist())),会发现input_ids和labels是一模一样的。
您好,最近正在学习词嵌入,看到您的代码,我想请问一下可以预训练自己的语料来做词嵌入吗?我的想法是,用maskLM来训练自己的语料,然后得到的model.bin再用transformer的AutoModel.from_pretrained调用得到词嵌入。请问是这种操作方式吗?这样得到的效果会比原本的bert直接得到的词嵌入效果更好吗?
制作bert预训练数据集DataManager的op_mask_wwm和op_mask那里,其实可以使用numpy取一个值域在[0,1]上的维度保持一样的array,然后用numpy来操作,应该会快得多,数据量太大会消耗很多时间。比如可以使用这种写法:
random_tensor = torch.rand(inputs['input_ids'].shape)
masked_tensor = (random_tensor < 0.15)(inputs['input_ids'] != 101)(inputs['input_ids'] != 102)*(inputs['input_ids'] != 0)
你好,我请问下我在测试的时候发现准确率好低啊,我在一个G的语料上训练,训练结果我看是已经收敛了,但是测试准确率只有48%
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.