baichuan-inc / Baichuan-7B

A large-scale 7B pretraining language model developed by BaiChuan-Inc.
https://huggingface.co/baichuan-inc/baichuan-7B
Apache License 2.0
5.67k stars 506 forks source link

[Question] 明明显存够,却显示out of memory #67

Open luyuhua opened 1 year ago

luyuhua commented 1 year ago

Required prerequisites

Questions

明明显存还有很多没有分配,却显示out of mem OutOfMemoryError: CUDA out of memory. Tried to allocate 86.00 MiB (GPU 0; 24.00 GiB total capacity; 9.07 GiB already allocated; 13.70 GiB free; 9.08 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Checklist

Xls1994 commented 1 year ago

可以看一下是否是程序内部限制了显存比例呢

dengxiaotian123 commented 1 year ago

model = AutoModelForCausalLM.from_pretrained("../baichuan-inc/baichuan-7B", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)

这样有效

jaweii commented 1 year ago

+1 跑train时内存溢出了