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

Problem about value range of valenc in func get_c4() #59

Open
88099981 opened this issue Nov 13, 2024 · 1 comment
Open

Problem about value range of valenc in func get_c4() #59

88099981 opened this issue Nov 13, 2024 · 1 comment

Comments

@88099981
Copy link

88099981 commented Nov 13, 2024

As I tried to use c4 dataset to run gptq, got an ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width)) , during debugging i found there may be some logical trouble about the code below when the number of tmp.input_ids.shape[1] is equal to the value of seqlen. We got a random.randint(0, -1).

    import random
    random.seed(0)
    valenc = []
    for _ in range(256):
        while True:
            i = random.randint(0, len(valdata) - 1)
            tmp = tokenizer(valdata[i]['text'], return_tensors='pt')
            if tmp.input_ids.shape[1] >= seqlen:
                break
        i = random.randint(0, tmp.input_ids.shape[1] - seqlen - 1)
        j = i + seqlen
        valenc.append(tmp.input_ids[:, i:j])

Please find attached my debugging record.
debug for gptq

@88099981
Copy link
Author

It works after I changed the code to i = random.randint(0, tmp.input_ids.shape[1] - seqlen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant