codertimo / BERT-pytorch

Google AI 2018 BERT pytorch implementation
Apache License 2.0
6.11k stars 1.29k forks source link

Question about random sampling. #13

Closed SongRb closed 5 years ago

SongRb commented 5 years ago

https://github.com/codertimo/BERT-pytorch/blob/7efd2b5a631f18ebc83cd16886b8c6ee77a40750/bert_pytorch/dataset/dataset.py#L50-L64

Well, seems random.random() always returns a positive number, so prob >= prob * 0.9 will always be true?

codertimo commented 5 years ago

Haha your right it seems else is more efficient. thank you for your comment 👀

leon-cas commented 5 years ago

if prob < prob 0.8: always False? elif prob 0.8 <= prob < prob * 0.9: always False?

artemisart commented 5 years ago

I also think these conditions are still wrong, I'm sending a PR