allenai / allenai/rslearn

Expose public helper for layer group naming convention

Aperta
#672 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
93
Fork
15
Merge medio
20h 56m
PR unite (30g)
4

Descrizione

## Context

rslearn internally names layer groups using the convention:
- First group: `{layer_name}` (no suffix)
- Subsequent groups: `{layer_name}.{index}` (e.g. `sentinel2_l2a.1`, `sentinel2_l2a.2`)

This naming logic lives inside rslearn's storage layer but isn't exposed as a public utility. Downstream consumers (like olmoearth_run) that need to reference layer names by index currently have to duplicate this naming pattern, creating a fragile coupling.

The layer names are needed in the model data module config to tell the DataModule which dataset layers to load as inputs. The dataset transpiler creates layers with these names (via DataSourceConfig with min/max matches), and rslearn names the resulting layer directories using the `.{index}` convention internally. The model config side needs to enumerate those same names without having a materialized dataset to inspect.

## Proposal

Add a small public helper function, something like:

```python
# rslearn/utils/naming.py (or similar)
def layer_group_name(prefix: str, group_index: int) -> str:
"""Canonical layer name for a given group index within a multi-match layer."""
return prefix if group_index == 0 else f"{prefix}.{group_index}"
```

This would let both rslearn internals and consumers use the same source of truth for this naming convention.

## Current workaround

```python
# olmoearth_run/runner/tools/olmoearth_config/transpilers/model/data.py
layer_name = layer_prefix if group_idx == 0 else f"{layer_prefix}.{group_idx}"
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.