Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crop bug #192

Closed
NoneWait opened this issue Dec 22, 2020 · 1 comment
Closed

crop bug #192

NoneWait opened this issue Dec 22, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@NoneWait
Copy link

NoneWait commented Dec 22, 2020

Hi,if you get the aug_cnt is 1, then when you call "self.sample", you will get the "ValueError: Sample larger than population or is negative"

  def _get_aug_range_idxes(self, tokens):
        aug_cnt = self.generate_aug_cnt(len(tokens))
        print("aug_cnt:", aug_cnt)
        direction = self.sample([-1, 1], 1)[0]

        if direction > 0:
            # right
            word_idxes = [i for i, _ in enumerate(tokens[:-aug_cnt+1])]
        else:
            # left
            word_idxes = [i for i, _ in enumerate(tokens[aug_cnt-1:])]

        start_aug_idx = self.sample(word_idxes, 1)[0]
        aug_idxes = [start_aug_idx + _*direction for _ in range(aug_cnt)]

        return aug_idxes
@makcedward makcedward added the bug Something isn't working label Dec 22, 2020
@makcedward
Copy link
Owner

Will fix it soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants