add --ramtorch_transformer_percent and --ramtorch_text_encoder_percent to treat it more like block swap - #2465
Merged
Merged
Conversation
…t to treat it more like block swap
samzhang996-hue
pushed a commit
to samzhang996-hue/SimpleTuner
that referenced
this pull request
Apr 27, 2026
add --ramtorch_transformer_percent and --ramtorch_text_encoder_percent to treat it more like block swap
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.
This pull request introduces support for partial offloading of Linear layers to RamTorch, allowing users to specify the percentage of eligible layers to offload for both transformer and text encoder components. This provides finer control over VRAM usage and training speed. The changes update documentation in multiple languages and modify the codebase to support and utilize the new percentage-based offloading.
Feature: Partial RamTorch Offloading
ramtorch_transformer_percentandramtorch_text_encoder_percentto allow specifying the percentage (0-100) of eligible Linear layers to offload for transformers and text encoders, respectively. These are documented in English, Spanish, Portuguese, Japanese, Hindi, and Chinese option files. [1] [2] [3] [4] [5] [6]Core Logic Updates
_apply_ramtorch_layersmethod and its usage across all model helper files to accept and pass thepercentargument, enabling partial offloading for both transformer models and text encoders. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]RamTorch Utility Enhancements
replace_linear_layers_with_ramtorchinramtorch.pyto support percentage-based layer replacement, including logic to count eligible layers and select only the specified percentage for replacement. [1] [2] [3] [4]These changes collectively provide users with more flexibility in managing memory and performance trade-offs during model training.