Support explicit_chunk for mode-choice components#1088
Open
vincentgong7 wants to merge 1 commit into
Open
Conversation
Location, destination, and scheduling components already honor the `explicit_chunk` setting (a fixed chunk size, used when chunk_training_mode: explicit), but mode-choice components did not: the setting was never plumbed from the component settings into simple_simulate's chunk loop. This wires it through: add `explicit_chunk` to TemplatedLogitComponentSettings (the base for mode-choice settings), and pass it via mode_choice_simulate -> simple_simulate -> adaptive_chunked_choosers. Defaults to 0 (unchanged behavior). This lets tour_mode_choice and trip_mode_choice run with a fixed, bounded per-chunk memory footprint, which is what makes large samples fit on memory-constrained machines under chunk_training_mode: explicit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
What
Plumb the existing
explicit_chunksetting through to the mode-choice components(
tour_mode_choice,trip_mode_choice), matching how location, destination, and schedulingcomponents already use it.
Why
explicit_chunk(a fixed per-chunk chooser count, active underchunk_training_mode: explicit) lets acomponent run with a deterministic, bounded memory footprint. Location/destination/scheduling
components honor it via
LocationComponentSettings.explicit_chunk, but mode-choice components neverreceived it — the field didn't exist on their settings class and
mode_choice_simulate/simple_simulateneither accepted nor forwarded it.On memory-constrained machines the adaptive chunker grows each chunk toward its memory budget, so peak
RSS is roughly constant regardless of sample size — which can OOM large models even after subsampling.
Fixed
explicit_chunksizes bound the peak. This change makes that strategy usable for mode choice too;for us it was the last unchunkable core step when fitting a full-sample run (8.1M trips, 7787 zones) onto
a 64 GB node.
What changed (backward-compatible — default
0= unchanged behavior)TemplatedLogitComponentSettings: newexplicit_chunk: float = 0field (the base for mode-choicesettings; mirrors the field already on
LocationComponentSettings).mode_choice_simulate(...): newexplicit_chunk_sizeparameter, forwarded tosimple_simulate.run_tour_mode_choice_simulate(...)andtrip_mode_choice(...): passexplicit_chunk_size=model_settings.explicit_chunk.simple_simulate(...): newexplicit_chunk_sizeparameter, forwarded tochunk.adaptive_chunked_choosers.4 files changed, 16 insertions(+), 1 deletion(-).
Usage
Testing
Verified on a full-sample run (8.1M trips, 7787 zones) on a 64 GB node: tour/trip mode choice ran with a
bounded per-chunk memory footprint under
explicit_chunk: 5000; with the default (0) behavior isidentical to before.
Acknowledgement
This work was supported by the XCarcity project. https://xcarcity.nl