Skip to content

Commit

Permalink
docs: add chunking documentation, rename ANEMOI_INFERENCE_NUM_CHUNKS
Browse files Browse the repository at this point in the history
  • Loading branch information
japols committed Oct 1, 2024
1 parent c518c38 commit 7c0daa7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ Keep it human-readable, your future self will thank you!
## [Unreleased](https://github.com/ecmwf/anemoi-models/compare/0.3.0...HEAD)

### Added

- GraphTransformerMapperBlock chunking to reduce memory usage during inference [#46](https://github.com/ecmwf/anemoi-models/pull/46)
- Codeowners file
- Pygrep precommit hooks
- Docsig precommit hooks
- Changelog merge strategy
- configurabilty of the dropout probability in the the MultiHeadSelfAttention module
- Variable Bounding as configurable model layers [#13](https://github.com/ecmwf/anemoi-models/issues/13)

- CI workflow to update the changelog on release
- Remapper: Preprocessor for remapping one variable to multiple ones. Includes changes to the data indices since the remapper changes the number of variables. With optional config keywords.

### Changed
- Bugfixes for CI

Expand Down
14 changes: 14 additions & 0 deletions docs/modules/layers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
Layers
########

***********************
Environment Variables
***********************

``ANEMOI_INFERENCE_NUM_CHUNKS``
===============================

This environment variable controls the number of chunks used in the
`Mapper` during inference. Setting this variable allows the model to
split large computations into a specified number of smaller chunks,
reducing memory overhead. If not set, it falls back to the default value
of, 1 i.e. no chunking. See pull request `#46
<https://github.com/ecmwf/anemoi-models/pull/46>`_.

*********
Mappers
*********
Expand Down
4 changes: 3 additions & 1 deletion src/anemoi/models/layers/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
from anemoi.models.layers.mlp import MLP

LOGGER = logging.getLogger(__name__)
NUM_CHUNKS_INFERENCE = int(os.environ.get("ANEMOI_NUM_CHUNKS_INFERENCE", "1"))

# Number of Mapper chunks used during inference (https://github.com/ecmwf/anemoi-models/pull/46)
NUM_CHUNKS_INFERENCE = int(os.environ.get("ANEMOI_INFERENCE_NUM_CHUNKS", "1"))


class BaseBlock(nn.Module, ABC):
Expand Down

0 comments on commit 7c0daa7

Please sign in to comment.