Zielon / MICA

MICA - Towards Metrical Reconstruction of Human Faces [ECCV2022]
https://zielon.github.io/mica/
Other
551 stars 78 forks source link

Cuda out of memory #48

Closed WangXuan2401 closed 1 year ago

WangXuan2401 commented 1 year ago

Hi~ Thanks a lot for your great work. Recently, I was just running demo but got the error of "oom". The error is shown below. I used Linux server with only one GPU 3090-24G with Ubuntu. I was wondering if the problem caused by my device, and can you give me some suggestions as I have no more gpu resources.

(MICA) root@I11eaa2113200301aa4:/home/MICA# python demo.py
2023-04-11 14:03:50.577 | INFO     | models.flame:__init__:54 - [FLAME] creating the FLAME Decoder
Traceback (most recent call last):
  File "/home/MICA/demo.py", line 160, in <module>
    main(cfg, args)
  File "/home/MICA/demo.py", line 112, in main
    mica = util.find_model_using_name(model_dir='micalib.models', model_name=cfg.model.name)(cfg, device)
  File "/home/MICA/micalib/models/mica.py", line 37, in __init__
    self.initialize()
  File "/home/MICA/micalib/base_model.py", line 44, in initialize
    self.create_flame(self.cfg.model)
  File "/home/MICA/micalib/base_model.py", line 52, in create_flame
    self.flame = FLAME(model_cfg).to(self.device)
  File "/usr/local/miniconda3/envs/MICA/lib/python3.9/site-packages/torch/nn/modules/module.py", line 987, in to
    return self._apply(convert)
  File "/usr/local/miniconda3/envs/MICA/lib/python3.9/site-packages/torch/nn/modules/module.py", line 662, in _apply
    param_applied = fn(param)
  File "/usr/local/miniconda3/envs/MICA/lib/python3.9/site-packages/torch/nn/modules/module.py", line 985, in convert
    return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
RuntimeError: CUDA error: out of memory
Zielon commented 1 year ago

Hello, MICA does not need a lot of resources for either inference or training. It looks like some problem with FLAME model which you are loading. Have you used the install script which I provided?

WangXuan2401 commented 1 year ago

Hello, MICA does not need a lot of resources for either inference or training. It looks like some problem with FLAME model which you are loading. Have you used the install script which I provided?

Yes. I used the install.sh to create MICA virtual env.

And thanks for your reply, I have already solved the problem by adding one more gpu.