From 1dd50a26d077157b4c8333ded0d57f588ace149b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 7 Mar 2026 13:12:01 +0000 Subject: [PATCH 1/2] migrate logging usage to loguru Co-authored-by: sparkleMing --- depth_anything_v2/dinov2.py | 5 +---- depth_anything_v2/dinov2_layers/attention.py | 5 +---- depth_anything_v2/dinov2_layers/block.py | 5 +---- pyproject.toml | 2 +- requirements.txt | 3 ++- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/depth_anything_v2/dinov2.py b/depth_anything_v2/dinov2.py index 83d2508..da39cfa 100644 --- a/depth_anything_v2/dinov2.py +++ b/depth_anything_v2/dinov2.py @@ -9,20 +9,17 @@ from functools import partial import math -import logging from typing import Sequence, Tuple, Union, Callable import torch import torch.nn as nn import torch.utils.checkpoint +from loguru import logger from torch.nn.init import trunc_normal_ from .dinov2_layers import Mlp, PatchEmbed, SwiGLUFFNFused, MemEffAttention, NestedTensorBlock as Block -logger = logging.getLogger("dinov2") - - def named_apply(fn: Callable, module: nn.Module, name="", depth_first=True, include_root=False) -> nn.Module: if not depth_first and include_root: fn(module=module, name=name) diff --git a/depth_anything_v2/dinov2_layers/attention.py b/depth_anything_v2/dinov2_layers/attention.py index 43fbc9d..15460f9 100644 --- a/depth_anything_v2/dinov2_layers/attention.py +++ b/depth_anything_v2/dinov2_layers/attention.py @@ -8,16 +8,13 @@ # https://github.com/facebookresearch/dino/blob/master/vision_transformer.py # https://github.com/rwightman/pytorch-image-models/tree/master/timm/models/vision_transformer.py -import logging - +from loguru import logger from torch import Tensor from torch import nn import comfy.ops ops = comfy.ops.manual_cast from comfy.ldm.modules.attention import optimized_attention -logger = logging.getLogger("dinov2") - try: from xformers.ops import memory_efficient_attention, unbind diff --git a/depth_anything_v2/dinov2_layers/block.py b/depth_anything_v2/dinov2_layers/block.py index 25488f5..420d057 100644 --- a/depth_anything_v2/dinov2_layers/block.py +++ b/depth_anything_v2/dinov2_layers/block.py @@ -8,10 +8,10 @@ # https://github.com/facebookresearch/dino/blob/master/vision_transformer.py # https://github.com/rwightman/pytorch-image-models/tree/master/timm/layers/patch_embed.py -import logging from typing import Callable, List, Any, Tuple, Dict import torch +from loguru import logger from torch import nn, Tensor from .attention import Attention, MemEffAttention @@ -20,9 +20,6 @@ from .mlp import Mlp -logger = logging.getLogger("dinov2") - - try: from xformers.ops import fmha from xformers.ops import scaled_index_add, index_select_cat diff --git a/pyproject.toml b/pyproject.toml index 5b98871..cdbd174 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "comfyui-depthanythingv2" description = "ComfyUI nodes to use [a/DepthAnythingV2](https://depth-anything-v2.github.io/)\nNOTE:Models autodownload to ComfyUI/models/depthanything from [a/https://huggingface.co/Kijai/DepthAnythingV2-safetensors/tree/main](https://huggingface.co/Kijai/DepthAnythingV2-safetensors/tree/main)" version = "1.0.1" license = "LICENSE" -dependencies = ["huggingface_hub", "accelerate"] +dependencies = ["huggingface_hub", "accelerate", "loguru"] [project.urls] Repository = "https://github.com/kijai/ComfyUI-DepthAnythingV2" diff --git a/requirements.txt b/requirements.txt index ee9cb40..80217e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ huggingface_hub -accelerate \ No newline at end of file +accelerate +loguru \ No newline at end of file From 1126297cb21fef0aa35e114a373d695f716017cd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 7 Mar 2026 13:18:27 +0000 Subject: [PATCH 2/2] Revert "migrate logging usage to loguru" This reverts commit 1dd50a26d077157b4c8333ded0d57f588ace149b. --- depth_anything_v2/dinov2.py | 5 ++++- depth_anything_v2/dinov2_layers/attention.py | 5 ++++- depth_anything_v2/dinov2_layers/block.py | 5 ++++- pyproject.toml | 2 +- requirements.txt | 3 +-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/depth_anything_v2/dinov2.py b/depth_anything_v2/dinov2.py index da39cfa..83d2508 100644 --- a/depth_anything_v2/dinov2.py +++ b/depth_anything_v2/dinov2.py @@ -9,17 +9,20 @@ from functools import partial import math +import logging from typing import Sequence, Tuple, Union, Callable import torch import torch.nn as nn import torch.utils.checkpoint -from loguru import logger from torch.nn.init import trunc_normal_ from .dinov2_layers import Mlp, PatchEmbed, SwiGLUFFNFused, MemEffAttention, NestedTensorBlock as Block +logger = logging.getLogger("dinov2") + + def named_apply(fn: Callable, module: nn.Module, name="", depth_first=True, include_root=False) -> nn.Module: if not depth_first and include_root: fn(module=module, name=name) diff --git a/depth_anything_v2/dinov2_layers/attention.py b/depth_anything_v2/dinov2_layers/attention.py index 15460f9..43fbc9d 100644 --- a/depth_anything_v2/dinov2_layers/attention.py +++ b/depth_anything_v2/dinov2_layers/attention.py @@ -8,13 +8,16 @@ # https://github.com/facebookresearch/dino/blob/master/vision_transformer.py # https://github.com/rwightman/pytorch-image-models/tree/master/timm/models/vision_transformer.py -from loguru import logger +import logging + from torch import Tensor from torch import nn import comfy.ops ops = comfy.ops.manual_cast from comfy.ldm.modules.attention import optimized_attention +logger = logging.getLogger("dinov2") + try: from xformers.ops import memory_efficient_attention, unbind diff --git a/depth_anything_v2/dinov2_layers/block.py b/depth_anything_v2/dinov2_layers/block.py index 420d057..25488f5 100644 --- a/depth_anything_v2/dinov2_layers/block.py +++ b/depth_anything_v2/dinov2_layers/block.py @@ -8,10 +8,10 @@ # https://github.com/facebookresearch/dino/blob/master/vision_transformer.py # https://github.com/rwightman/pytorch-image-models/tree/master/timm/layers/patch_embed.py +import logging from typing import Callable, List, Any, Tuple, Dict import torch -from loguru import logger from torch import nn, Tensor from .attention import Attention, MemEffAttention @@ -20,6 +20,9 @@ from .mlp import Mlp +logger = logging.getLogger("dinov2") + + try: from xformers.ops import fmha from xformers.ops import scaled_index_add, index_select_cat diff --git a/pyproject.toml b/pyproject.toml index cdbd174..5b98871 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "comfyui-depthanythingv2" description = "ComfyUI nodes to use [a/DepthAnythingV2](https://depth-anything-v2.github.io/)\nNOTE:Models autodownload to ComfyUI/models/depthanything from [a/https://huggingface.co/Kijai/DepthAnythingV2-safetensors/tree/main](https://huggingface.co/Kijai/DepthAnythingV2-safetensors/tree/main)" version = "1.0.1" license = "LICENSE" -dependencies = ["huggingface_hub", "accelerate", "loguru"] +dependencies = ["huggingface_hub", "accelerate"] [project.urls] Repository = "https://github.com/kijai/ComfyUI-DepthAnythingV2" diff --git a/requirements.txt b/requirements.txt index 80217e9..ee9cb40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ huggingface_hub -accelerate -loguru \ No newline at end of file +accelerate \ No newline at end of file