open-compass / open-compass/opencompass
多卡推理,内存溢出[Bug]
@bittersweet1999 is already working on this.
Since Feb 6, 2024.
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 869
- Avg merge
- 17h 52m
- Merged PRs (30d)
- 13
Description
先决条件
问题类型
我正在使用官方支持的任务/模型/数据集进行评估。
环境
环境正确,将max_seq_len设置为16k时可单卡正常推理,设置为32k时内存溢出。
重现问题 - 代码/配置示例
无
重现问题 - 命令或脚本
python run.py configs/eval_qwen_14b.py --reuse qwen_v1-5_14b
重现问题 - 错误信息
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 32.99 GiB. GPU 0 has a total capacty of 79.35 GiB of which 21.24 GiB is free. Process 142581 has 58.10 GiB memory in use. Of the allocated memory 24.01 GiB is allocated by PyTorch, and 33.60 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
其他信息
models = [
dict(
type=HuggingFaceCausalLM,
abbr='qwen-v1.5-14b-hf',
path="/mnt/data/wujx/models/qwen/qwen-v1.5-14b",
tokenizer_path="/mnt/data/wujx/models/qwen/qwen-v1.5-14b",
model_kwargs=dict(
device_map='auto',
trust_remote_code=False,
),
tokenizer_kwargs=dict(
padding_side='left',
truncation_side='left',
trust_remote_code=True,
use_fast=False,
),
pad_token_id=151643,
max_out_len=128,
max_seq_len=32768,
batch_size=1,
run_cfg=dict(num_gpus=4, num_procs=1, max_num_workers=1),
)
]
我使用了4张A100-80G,测试 qwen-14b,最大窗口设为32k会导致内存溢出。
运行信息:
[2024-02-06 08:22:43,250] [INFO] [real_accelerator.py:133:get_accelerator] Setting ds_accelerator to cuda (auto detect)
02/06 08:22:45 - OpenCompass - INFO - Reusing experiements from qwen_v1-5_14b
02/06 08:22:45 - OpenCompass - WARNING - SlurmRunner is not used, so the partition argument is ignored.
02/06 08:22:45 - OpenCompass - INFO - Partitioned into 1 tasks.
launch OpenICLInfer[qwen-v1.5-14b-hf/LongBench_vcsum,qwen-v1.5-14b-hf/LongBench_narrativeqa,qwen-v1.5-14b-hf/LongBench_multifieldqa_zh,qwen-v1.5-14b-hf/LongBench_lsht,qwen-v1.5-14b-hf/LongBench_dureader,qwen-v1.5-14b-hf/LongBench_passage_retrieval_zh] on GPU 0,1,2,3
好像是每张卡都在独立推理。
我想要的是4张卡都提供给一个进程做推理,而不是4张卡4个进程。
该怎么配置呢?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.