-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
190 lines (168 loc) · 8.22 KB
/
Copy pathpyproject.toml
File metadata and controls
190 lines (168 loc) · 8.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
[project]
name = "megadetector-overhead"
version = "0.1.0"
description = "Wildlife detection in overhead and aerial imagery (HerdNet + DINOv3 training/eval stack)."
readme = "README.md"
license = { file = "LICENSE.txt" }
requires-python = ">=3.11,<3.13"
authors = [
{ name = "Microsoft AI for Good Lab" },
]
keywords = ["wildlife", "drone", "aerial-imagery", "detection", "pytorch", "dinov3", "herdnet"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
# ── Deep learning core ──────────────────────────────────────────────
"torch>=2.0",
"torchvision",
"torchmetrics",
# ── Numerical / scientific ──────────────────────────────────────────
"numpy",
"pandas",
"pillow",
"opencv-python-headless",
"scikit-learn",
"scikit-image",
"matplotlib",
"tqdm",
"pyyaml",
# ── Config / experiment tracking ────────────────────────────────────
"hydra-core",
"omegaconf",
"wandb",
# ── Augmentation / vision ───────────────────────────────────────────
"albumentations",
# ── DINOv3 transitive dependencies (also declared by dinov3/setup.py;
# re-declared here so uv's resolver pins them at the project level) ──
"ftfy",
"regex",
"iopath",
"submitit",
"termcolor",
# ── Geospatial (used by tools/patcher.py for georeferenced rasters) ──
"rasterio",
"geopandas",
"fiona",
"shapely",
"affine",
# ── Networking / I/O helpers used by animaloc ───────────────────────
"huggingface-hub",
"requests",
# ── Vendored DINOv3 (installed editably from ./dinov3 via [tool.uv.sources]) ──
"dinov3",
]
[project.optional-dependencies]
dev = [
"pytest",
"ruff",
"mypy",
]
docs = [
"mkdocs",
"mkdocs-material",
"pymdown-extensions",
]
[project.urls]
Homepage = "https://github.com/microsoft/MegaDetector-Overhead"
Documentation = "https://microsoft.github.io/MegaDetector-Overhead/"
Repository = "https://github.com/microsoft/MegaDetector-Overhead"
Issues = "https://github.com/microsoft/MegaDetector-Overhead/issues"
# ─────────────────────────────────────────────────────────────────────────────
# PyTorch CPU / GPU selection (uv dependency-groups).
#
# Two simple, reproducible options:
# CPU (default): uv sync
# GPU: uv sync --no-default-groups --group gpu
# (or `make sync` / `make sync-gpu`). A bare `uv sync` installs the CPU build
# because `cpu` is the default group — see [tool.uv] default-groups.
#
# The `gpu` group pins the CUDA 12.1 build (torch 2.5.1+cu121), which supports
# NVIDIA Volta (sm_70, e.g. Tesla V100) through Hopper (sm_90). NOTE: this is
# about the GPU *architecture*, not the driver — newer cu124/cu128 wheels DROP
# Volta kernels, so the V100 needs cu121. A CUDA-12.1 build runs fine on newer
# drivers (they are backward-compatible). Users with Blackwell-only GPUs that
# need cu128 can add their own `cu128` group following this same pattern.
# ─────────────────────────────────────────────────────────────────────────────
[dependency-groups]
cpu = ["torch", "torchvision"]
gpu = ["torch", "torchvision"]
# ─────────────────────────────────────────────────────────────────────────────
# uv configuration.
# ─────────────────────────────────────────────────────────────────────────────
[tool.uv]
# Keep the root project itself editable in the .venv so `import animaloc`
# picks up local edits without a re-sync.
package = true
# `cpu` is the default group: a bare `uv sync` installs the CPU PyTorch build.
default-groups = ["cpu"]
# CPU and GPU builds are mutually exclusive — only one may be installed at a time.
conflicts = [
[
{ group = "cpu" },
{ group = "gpu" },
],
]
# Resolve the lockfile for the platforms we support: 64-bit Linux, macOS, and
# 64-bit Windows. This deliberately excludes niche targets (Linux/Windows on
# ARM), whose PyTorch CPU wheels are sometimes published under odd local-version
# tags (e.g. `torchvision 0.27.1+df56172`, win_arm64-only) that otherwise hijack
# the universal resolution and leave the mainstream platforms without an
# installable wheel.
environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'darwin'",
"sys_platform == 'win32' and platform_machine == 'AMD64'",
]
# Install the vendored DINOv3 from the in-tree path (editable); route torch and
# torchvision to the matching PyTorch index per dependency-group. The indexes are
# Linux/Windows only; macOS falls back to PyPI (its wheels are already CPU/MPS).
[tool.uv.sources]
dinov3 = { path = "dinov3", editable = true }
torch = [
{ index = "pytorch-cpu", group = "cpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
{ index = "pytorch-cu121", group = "gpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cpu", group = "cpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
{ index = "pytorch-cu121", group = "gpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
# Explicit PyTorch indexes (only used by packages that opt in via sources above,
# not for generic dependencies).
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[[tool.uv.index]]
name = "pytorch-cu121"
url = "https://download.pytorch.org/whl/cu121"
explicit = true
# ─────────────────────────────────────────────────────────────────────────────
# Build system: setuptools is enough — we only ship the animaloc package
# from the repo root. DINOv3 has its own setup.py and is installed as a
# separate distribution from ./dinov3.
# ─────────────────────────────────────────────────────────────────────────────
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["."]
include = ["animaloc*"]
exclude = ["dinov3*", "tools*", "configs*", "docs*", "tests*"]
[tool.setuptools.package-data]
animaloc = ["**/*.yaml", "**/*.yml"]
# ─────────────────────────────────────────────────────────────────────────────
# Ruff (linter / formatter) — matches the line length used by DINOv3 to keep
# style consistent across the repo.
# ─────────────────────────────────────────────────────────────────────────────
[tool.ruff]
line-length = 120
target-version = "py311"
extend-exclude = ["dinov3"]