InternLM / InternLM/InternLM-XComposer
使用dispatch_model后再generate后报错(Expected all tensors to be on the same device)(参考example中的chat例子)
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 175
- PR merge metrics
- No merged PRs in 30d
Description
/paddle/lvwenyu01/lyk/model_dir/InternLM/modeling_InternLM.py:1745 in _reorder_cache │
│ │
│ 1742 │ │ │ for past_state in layer_past: │
│ 1743 │ │ │ │ │
│ 1744 │ │ │ │ print(past_state.device) │
│ ❱ 1745 │ │ │ reordered_past += (tuple( │
│ 1746 │ │ │ │ past_state.index_select(0, beam_idx) │
│ 1747 │ │ │ │ for past_state in layer_past), ) │
│ 1748 │ │ return reordered_past │
│ │
│ /paddle/lvwenyu01/lyk/model_dir/InternLM/modeling_InternLM.py:1746 in │
│ │
│ 1743 │ │ │ │ │
│ 1744 │ │ │ │ print(past_state.device) │
│ 1745 │ │ │ reordered_past += (tuple( │
│ ❱ 1746 │ │ │ │ past_state.index_select(0, beam_idx) │
│ 1747 │ │ │ │ for past_state in layer_past), ) │
│ 1748 │ │ return reordered_past │
│ 1749 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0!
(when checking argument for argument index in method wrapper_CUDA__index_select)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with modeling_InternLM.py around _reorder_cache, especially the index_select call shown in the traceback. Reproduce the example chat flow using dispatch_model followed by generate and inspect the printed tensor devices. Done means that this flow no longer raises the cuda:1/cuda:0 device mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100