Skip to content

ValueError: draft_choices was not cut enough / draft_len should not exceed 65 #13

@yangbohust

Description

@yangbohust

I adapted the REST solution to the Qwen-7b model and encountered the following problem when testing it on the Human-eval data set:
What may be the cause of this problem and how to solve it?

Traceback (most recent call last):
  File "code/opensource/my/REST/human_eval/rest_test.py", line 223, in <module>
    run_eval(
  File "code/opensource/my/REST/human_eval/rest_test.py", line 67, in run_eval
    candidates, tree_candidates, draft_buffers = generate_candidates_and_draft_buffer(
  File "code/opensource/my/REST/human_eval/../rest/model/utils.py", line 105, in generate_candidates_and_draft_buffer
    retrieved_token_list, _draft_attn_mask, _tree_indices, _draft_position_ids, _retrieve_indices = datastore.search(this_token, choices=max_num_draft)
  File "envs/rest/lib/python3.9/site-packages/draftretriever/__init__.py", line 54, in search
    return self.reader.search(
ValueError: draft_choices was not cut enough

// Because multiple nodes in the Trie may have same weights around the threshold, the number of draft tokens may exceed choices
// We roughly cut nodes to be less than choices in most cases.
let paths = cut_to_choices(verified, choices);
let (draft_choices, max_branch) = get_draft_choices(paths.clone());
if draft_choices.len() > choices as usize {
// It might not be cut enough because cut_to_choices() is best effort, as mentioned in the comment above
return Err(exceptions::PyValueError::new_err("draft_choices was not cut enough"));
}

Why can't the length of draft_choices be directly truncated to the length specified by the choices parameter?

Thanks,

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