Skip to content

Commit 286d346

Browse files
Merge pull request #1771 from roboflow/fix/depth-anythig-v2-fixes
Fix/depth anythig v2 fixes
2 parents d1a3f4e + 7a10e84 commit 286d346

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

inference_experimental/inference_exp/models/auto_loaders/models_registry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
EMBEDDING_TASK = "embedding"
1515
CLASSIFICATION_TASK = "classification"
1616
MULTI_LABEL_CLASSIFICATION_TASK = "multi-label-classification"
17+
DEPTH_ESTIMATION_TASK = "depth-estimation"
1718

1819

1920
@dataclass(frozen=True)
@@ -353,6 +354,10 @@ class RegistryEntry:
353354
module_name="inference_exp.models.yolact.yolact_instance_segmentation_trt",
354355
class_name="YOLOACTForInstanceSegmentationTRT",
355356
),
357+
("depth-anything-v2", DEPTH_ESTIMATION_TASK, BackendType.HF): LazyClass(
358+
module_name="inference_exp.models.depth_anything_v2.depth_anything_v2_hf",
359+
class_name="DepthAnythingV2HF"
360+
)
356361
}
357362

358363

inference_experimental/inference_exp/models/depth_anything_v2/depth_anything_v2_hf.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ def from_pretrained(
2020
cls,
2121
model_name_or_path: str,
2222
device: torch.device = DEFAULT_DEVICE,
23+
local_files_only: bool = True,
2324
**kwargs,
2425
) -> "DepthAnythingV2HF":
25-
model = AutoModelForDepthEstimation.from_pretrained(model_name_or_path).to(
26-
device
27-
)
26+
model = AutoModelForDepthEstimation.from_pretrained(
27+
model_name_or_path,
28+
local_files_only=local_files_only,
29+
).to(device)
2830
processor = AutoImageProcessor.from_pretrained(
29-
model_name_or_path, use_fast=True
31+
model_name_or_path,
32+
local_files_only=local_files_only,
33+
use_fast=True
3034
)
3135
return cls(model=model, processor=processor, device=device)
3236

inference_experimental/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "inference-exp"
3-
version = "0.16.4"
3+
version = "0.17.0rc2"
44
description = "Experimental vresion of inference package which is supposed to evolve into inference 1.0"
55
readme = "README.md"
66
requires-python = ">=3.9,<3.13"

inference_experimental/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)