LiheYoung / Depth-Anything

[CVPR 2024] Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data. Foundation Model for Monocular Depth Estimation
https://depth-anything.github.io
Apache License 2.0
6.82k stars 523 forks source link

High idle CPU usage #195

Closed jonahclarsen closed 3 months ago

jonahclarsen commented 3 months ago

Hi there,

I'm experiencing an odd issue on Windows. When I load the pipeline for either v1:

plugin.depth_anything = DepthAnything.from_pretrained(
    'LiheYoung/depth_anything_' + encoder + '14',
    cache_dir = os.path.join("models", "depth_anything"),
    local_files_only = True,
    revision = revision
    ).to(device).to(torch_dtype).eval()

or v2:

from depth_anything_v2.dpt import DepthAnythingV2
depth_anything = DepthAnythingV2(**{'encoder': 'vits', 'features': 64, 'out_channels': [48, 96, 192, 384]})

then for the rest of the python session, even if it's completely idle, CPU usage will be at 100%, whether or not I even inference the model or load_state_dict().

Any help would be greatly appreciated.

jonahclarsen commented 3 months ago

Some extra info: python 3.10.11 xformers 0.0.26.post1 torch 2.3.0+cu121 transformers 4.41.2 I'm using the latest version of the depth-anything-v2 code, downloaded from the hf space.

jonahclarsen commented 3 months ago

Sorry, it turns out it was caused by me running os.environ['KMP_BLOCKTIME'] = 'infinite' at one point in my code.