microsoft / microsoft/MInference

[Bug]: Can't run run_infinitebench.py

Open
#195 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.2k
Forks
82
Avg merge
1d 18h
Merged PRs (30d)
1

Description

Describe the bug

Hi,

Great work and thanks for sharing the code. I was trying to run run_infinitebench.py in experiment but then got this error

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/pdb.py", line 1723, in main
    pdb._runscript(mainpyfile)
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/pdb.py", line 1583, in _runscript
    self.run(statement)
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/bdb.py", line 598, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/home/ubuntu/MInference/experiments/infinite_bench/run_infinitebench.py", line 274, in <module>
    pred = get_pred(
  File "/home/ubuntu/MInference/experiments/infinite_bench/run_infinitebench.py", line 100, in get_pred
    outputs = model.generate(**input_tensors, generation_config=generation_config)
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context
    return func(*args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/site-packages/transformers/generation/utils.py", line 2564, in generate
    result = decoding_method(
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/site-packages/transformers/generation/utils.py", line 2756, in _sample
    model_kwargs = self._get_initial_cache_position(cur_len, input_ids.device, model_kwargs)
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/site-packages/transformers/generation/utils.py", line 1833, in _get_initial_cache_position
    past_length = cache.get_seq_length()
  File "/home/ubuntu/miniconda3/envs/minference/lib/python3.10/site-packages/minference/modules/kvcompression.py", line 439, in get_seq_length
    if len(self.key_cache) <= layer_idx:
AttributeError: 'DynamicCacheWithRepeat' object has no attribute 'key_cache'

If it helps, I'm using transformer 4.57.1 and vllm 0.11.0.

In addition, is it necessary to install vllm flash attn?
https://github.com/microsoft/MInference/blob/fc1c63f595a0143e47cf6af4bbb729bc31198ee9/minference/modules/minference_forward.py#L21
It only works with a quite old torch and vllm.

Would be great if you can take a look.

Thanks,
Rui

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from experiments/infinite_bench/run_infinitebench.py, then inspect minference/modules/kvcompression.py around get_seq_length and the reported DynamicCacheWithRepeat error. Compare the cache API used by transformers 4.57.1 with the versions supported by the project and review the vllm flash-attn import in minference/modules/minference_forward.py. Done means the experiment runs without this error and the required dependency versions are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.