Comments (2)
scatter_nd
sums up values with the same index, but we want to just pick a single value per index. If the values for an index are the same (e.g., we are just scattering a mask tensor of 1s), then dividing the summed values by the number of occurrences at that index fixes the issue. That's what is implemented in the code you linked to.
However, this does NOT fully fix having duplicate mask positions. It does stop there from being errors due to overflowing above the vocab size, but if (1) the same position is sampled twice and (2) the generator samples different tokens for the position then the replaced token will be a "random" token obtained by averaging the two sampled token ids. I didn't bother fixing this issue when developing ELECTRA because this occurs for a pretty small fraction of masked positions. But there actually is an easy fix: replace the sampling step (masked_lm_positions = tf.random.categorical...
in pretrain_helpers.mask
) with
masked_lm_positions = tf.math.top_k(
sample_logits + sample_gumbel(
modeling.get_shape_list(sample_logits)), N)[1]
This will do sampling without replacement when picking mask positions.
from electra.
That is clear. Thank you for the explanation.
from electra.
Related Issues (20)
- what should i do to extract the electra discriminator HOT 2
- ELECTRA-base fine tuned on MNLI HOT 1
- A possible mistake in the FLOPs calculation of attn_output_layer_norm in the file flops_computation.py
- no module named tensorflow.contrib HOT 1
- Electra Vocabulary HOT 1
- some confusions about paper HOT 1
- Question regarding TrainingsData/Validation Data split
- NumPy Import Error HOT 2
- Train electra with another tokenizer HOT 2
- About the Electra paper
- Optimal Learning Rate and Training Steps for Large Batch Size
- How can I draw this? HOT 1
- Tagging Task Segment ids
- Cannot import trace from tensorflow.python.profiler HOT 4
- sequence tagging tasks fails at metric reporting HOT 1
- Can I used run_mlm.py in transformer for fine-tuning generator(mlm) of electra
- failed to run cuBLAS routine: CUBLAS_STATUS_EXECUTION_FAILED HOT 1
- finetune preprocessing adding padding to the dataset error HOT 1
- How many parameters do discriminator and generator have?
- What is the maximum acceptance for the sentence length for the ELECTRA model?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electra.