Depth-Anything icon indicating copy to clipboard operation
Depth-Anything copied to clipboard

use local model find error

Open cgf120 opened this issue 1 year ago • 0 comments

use code:

`model_configs = { 'vitl': {'encoder': 'vitl', 'features': 256, 'out_channels': [256, 512, 1024, 1024]}, 'vitb': {'encoder': 'vitb', 'features': 128, 'out_channels': [96, 192, 384, 768]}, 'vits': {'encoder': 'vits', 'features': 64, 'out_channels': [48, 96, 192, 384]} }

encoder = 'vitl' # or 'vitb', 'vits' depth_anything = DepthAnything(model_configs[encoder]) model = depth_anything.load_state_dict(torch.load(f'/models/checkpoints/depth_anything_{encoder}14.pth')) ` replace code

model = DepthAnything.from_pretrained(f"LiheYoung/depth_anything_{encoder}14").to(DEVICE).eval()

Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/gradio/queueing.py", line 495, in call_prediction output = await route_utils.call_process_api( File "/usr/local/lib/python3.10/dist-packages/gradio/route_utils.py", line 232, in call_process_api output = await app.get_blocks().process_api( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1561, in process_api result = await self.call_function( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1179, in call_function prediction = await anyio.to_thread.run_sync( File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 851, in run result = context.run(func, *args) File "/usr/local/lib/python3.10/dist-packages/gradio/utils.py", line 678, in wrapper response = f(*args, **kwargs) File "/root/Depth-Anything/app.py", line 86, in on_submit depth = predict_depth(model, image) File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/root/Depth-Anything/app.py", line 63, in predict_depth return model(image) TypeError: '_IncompatibleKeys' object is not callable

cgf120 avatar Apr 22 '24 10:04 cgf120