ByteDance-Seed / ByteDance-Seed/Depth-Anything-3

Error while running the base usage code snipet

Open
#53 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.3k
Forks
702
PR merge metrics
No merged PRs in 30d

Description

I followed all the installation steps and when i try to run the following python module:
import glob, os, torch
from depth_anything_3.api import DepthAnything3

def go():
device = torch.device("cuda")
model = DepthAnything3.from_pretrained("depth-anything/da3nested-giant-large")
model = model.to(device=device)
example_path = "assets/examples/SOH"
images = sorted(glob.glob(os.path.join(example_path, "*.png")))
prediction = model.inference(
images,
)
# prediction.processed_images : [N, H, W, 3] uint8 array
print(prediction.processed_images.shape)
# prediction.depth : [N, H, W] float32 array
print(prediction.depth.shape)
# prediction.conf : [N, H, W] float32 array
print(prediction.conf.shape)
# prediction.extrinsics : [N, 3, 4] float32 array # opencv w2c or colmap format
print(prediction.extrinsics.shape)
# prediction.intrinsics : [N, 3, 3] float32 array
print(prediction.intrinsics.shape)

return None

if __name__ == "__main__":
go()

i get the following error:

(base) xxxx@xxxx:~/depth-anything3/Depth-Anything-3-main$ python -m test
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/home/xxx/depth-anything3/Depth-Anything-3-main/test.py", line 27, in
go()
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/test.py", line 6, in go
model = DepthAnything3.from_pretrained("depth-anything/da3nested-giant-large")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxx/miniconda3/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 89, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/huggingface_hub/hub_mixin.py", line 559, in from_pretrained
instance = cls._from_pretrained(
^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/huggingface_hub/hub_mixin.py", line 773, in _from_pretrained
model = cls(**model_kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/api.py", line 89, in __init__
self.model = create_object(self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/cfg.py", line 128, in create_object
return item(**config)
^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/da3.py", line 273, in __init__
self.da3 = create_object(anyview)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/cfg.py", line 128, in create_object
return item(**config)
^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/da3.py", line 70, in __init__
self.backbone = net if isinstance(net, nn.Module) else create_object(_wrap_cfg(net))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/cfg.py", line 118, in create_object
item = import_item(
^^^^^^^^^^^^
File "/home/xxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/cfg.py", line 105, in import_item
return getattr(importlib.import_module(path), name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/dinov2/dinov2.py", line 14, in
from depth_anything_3.model.dinov2.vision_transformer import (
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/dinov2/vision_transformer.py", line 20, in
from .layers import LayerScale # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/dinov2/layers/__init__.py", line 13, in
from .swiglu_ffn import SwiGLUFFN, SwiGLUFFNFused
File "/home/xxxx/depth-anything3/Depth-Anything-3-main/src/depth_anything_3/model/dinov2/layers/swiglu_ffn.py", line 36, in
from xformers.ops import SwiGLU
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/xformers/ops/__init__.py", line 8, in
from .fmha import (
File "/home/xxxxx/miniconda3/lib/python3.12/site-packages/xformers/ops/fmha/__init__.py", line 10, in
from . import (
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/xformers/ops/fmha/triton_splitk.py", line 548, in
_get_splitk_kernel(num_groups)
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/xformers/ops/fmha/triton_splitk.py", line 503, in _get_splitk_kernel
_fwd_kernel_splitK_unrolled = unroll_varargs(_fwd_kernel_splitK, N=num_groups)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/xformers/triton/vararg_kernel.py", line 166, in unroll_varargs
jitted_fn = triton.jit(fn)
^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/triton/runtime/jit.py", line 947, in jit
return decorator(fn)
^^^^^^^^^^^^^
File "/home/xxxxx/miniconda3/lib/python3.12/site-packages/triton/runtime/jit.py", line 935, in decorator
return JITFunction(
^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/triton/runtime/jit.py", line 769, in __init__
super().__init__(fn)
File "/home/xxxx/miniconda3/lib/python3.12/site-packages/triton/runtime/jit.py", line 503, in __init__
self.raw_src, self.starting_line_number = inspect.getsourcelines(fn)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/inspect.py", line 1270, in getsourcelines
return getblock(lines[lnum:]), lnum + 1
^^^^^^^^^^^^^^^^^^^^^^
File "/home/xxxx/miniconda3/lib/python3.12/inspect.py", line 1237, in getblock
for _token in tokens:
File "/home/xxxxx/miniconda3/lib/python3.12/tokenize.py", line 582, in _generate_tokens_from_c_tokenizer
raise TokenError(msg, (e.lineno, e.offset)) from None
tokenize.TokenError: ('unterminated string literal (detected at line 1122)', (1122, 1))

can somebody help me?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.