zhongpei / Comfyui_image2prompt

image to prompt by vikhyatk/moondream1
GNU General Public License v3.0
246 stars 14 forks source link

run deepseek-vl-7b-chat:torch.cuda.OutOfMemoryError: Allocation on device 0 #75

Open darkmirrors opened 1 week ago

darkmirrors commented 1 week ago

是我的问题吗?跑 deepseek-vl-7b-chat 这个例子 显卡:NVIDIA GeForce RTX 3080 supports bf16. 内存:32GB

跑第一个demo 就内存溢出了?堆栈信息如下 @zhongpei

NVIDIA GeForce RTX 3080 supports bf16.
!!! Exception during processing!!! Allocation on device 
Traceback (most recent call last):
  File "/mnt/data0/work/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/mnt/data0/work/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/mnt/data0/work/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/mnt/data0/work/ComfyUI/custom_nodes/Comfyui_image2prompt/src/image2text.py", line 52, in get_model
    return (DeepseekVLModel(device=device,low_memory=low_memory,model_name=model), )
  File "/mnt/data0/work/ComfyUI/custom_nodes/Comfyui_image2prompt/src/deepseek_model.py", line 33, in __init__
    self.vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2528, in cuda
    return super().cuda(*args, **kwargs)
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 915, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 779, in _apply
    module._apply(fn)
  [Previous line repeated 3 more times]
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 804, in _apply
    param_applied = fn(param)
  File "/home/jingchengwu/.local/lib/python3.9/site-packages/torch/nn/modules/module.py", line 915, in <lambda>
    return self._apply(lambda t: t.cuda(device))
torch.cuda.OutOfMemoryError: Allocation on device