Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad266fb

Browse files
More tacoreader to optional dependencies
1 parent 654b543 commit ad266fb

3 files changed

Lines changed: 34 additions & 4 deletions

File tree

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,22 @@ git clone https://github.com/torchgeo/terratorch.git
102102
cd terratorch
103103
pip install -e .[test]
104104
```
105-
To install terratorch with partial (work in development) support for Weather Foundation Models, `pip install -e .[wxc]`, which currently works just for `Python >= 3.11`.
105+
106+
### Optional Dependencies
107+
108+
TerraTorch supports several optional features that can be installed separately:
109+
110+
- **VLLM support**: `pip install terratorch[vllm]`
111+
- **Weather Foundation Models**: `pip install terratorch[wxc]` (Python >= 3.11 only)
112+
- **PEFT (Parameter-Efficient Fine-Tuning)**: `pip install terratorch[peft]`
113+
- **Visualization tools**: `pip install terratorch[visualize]`
114+
- **GeoBench v2**: `pip install terratorch[geobenchv2]`
115+
- **Logging with Weights & Biases**: `pip install terratorch[logging]`
116+
- **MMSegmentation support**: `pip install terratorch[mmseg]`
117+
- **Surya support**: `pip install terratorch[surya]`
118+
- **Tortilla file support**: `pip install terratorch[tortilla]` - Required for loading datasets from tortilla files
119+
120+
You can install multiple optional dependencies at once: `pip install terratorch[vllm,peft,logging]`
106121

107122
## Documentation
108123

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ dependencies = [
6666
"tifffile",
6767
"python-box",
6868
"tqdm",
69-
"tacoreader==0.5.6",
7069
"tensorboard",
7170
"diffusers",
7271
"scikit-learn>=1.3.2",
@@ -156,6 +155,10 @@ vllm_test = [
156155
"imagehash",
157156
]
158157

158+
tortilla = [
159+
"tacoreader==0.5.6",
160+
]
161+
159162
[project.urls]
160163
Documentation = "https://torchgeo.github.io/terratorch/"
161164
Issues = "https://github.com/torchgeo/terratorch/issues"

terratorch/datamodules/generic_pixel_wise_data_module.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@
1313
import albumentations as A
1414
import kornia.augmentation as K
1515
import numpy as np
16-
import tacoreader
1716
import torch
1817
from albumentations.core.composition import BaseCompose, Compose
18+
19+
try:
20+
import tacoreader
21+
22+
HAS_TACOREADER = True
23+
except ImportError:
24+
HAS_TACOREADER = False
25+
tacoreader = None # type: ignore
1926
from kornia.augmentation import AugmentationSequential
2027
from torch import Tensor
2128
from torch.utils.data import DataLoader
@@ -221,7 +228,12 @@ def __init__(
221228
"Use tortilla_file OR data roots (not both)."
222229
)
223230

224-
self.tortilla_df = tacoreader.load(str(tortilla_file)) if tortilla_file is not None else None
231+
if tortilla_file is not None and not HAS_TACOREADER:
232+
raise ImportError(
233+
"tacoreader is required to use tortilla files. Install it with: pip install terratorch[tortilla]"
234+
)
235+
236+
self.tortilla_df = tacoreader.load(str(tortilla_file)) if tortilla_file is not None else None # type: ignore
225237

226238
def _get_tortilla_indices(self, stage: str) -> list[Hashable] | None:
227239
if self.tortilla_df is None:

0 commit comments

Comments
 (0)