Implementation of "CLINE: Contrastive Learning with Semantic Negative Examples for Natural Language Understanding" (ACL 2021).
sh wordreplace.sh
sh start.sh
sh run_glue.sh
Lexically Error Correction BERT.
total_loss = torch.exp(-self.log_vars[0]) * mlm_loss + torch.clamp(self.log_vars[0], min=0) + \ torch.exp(-self.log_vars[1]) * tec_loss + torch.clamp(self.log_vars[1], min=0) + \ torch.exp(-self.log_vars[2]) * sec_loss + torch.clamp(self.log_vars[2], min=0)
Hello, I wonder why use torch.clamp here. torch.clamp can guarantee the value >= 0, but I think the value here (self.log_vars) are always positive. because we initialize self.log_vars to be zero and it will monotone increase during training, which found after I derive gradients manually.
Is there something wrong with me? :)
Hi! I found something a bit confusing that you might be able to clarify. For the contrastive loss implemented in "LecbertForPreTraining" class, you use a sigmoid as the activation function before applying the BCE loss but in the paper you mention a normal InfoNCE loss (with softmax activations) was used. Am I misunderstanding something perhaps?
I see that this code can generate negative cases in English, but I don't think it can be used to generate negative cases in Chinese, can you answer? Thank you very much!
For example, python, torch, transformers, spacey, lemminfect, etc
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.