Skip to content

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

Description

@88099981

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions