codertimo / codertimo/BERT-pytorch

In Next Sentence Prediction task,the original code may choose the same line when you try to use the negative sample

Open
#86 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

```bash
def get_random_line(self):
...
return self.lines[random.randrange(len(self.lines))][1]
...
```
it should be changed to the following:
```bash
def get_random_line(self,index):
...
tmp = random.randrange(len(self.lines))
while(tmp == index):
tmp = random.randrange(len(self.lines))
return self.lines[random.randrange(len(self.lines))][1]
...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.