pub struct ParallelismConfig {
pub dp_size: usize,
pub mp_size: usize,
pub pp_size: usize,
pub num_micro_batches: usize,
pub gradient_accumulation: bool,
pub accumulation_steps: usize,
pub activation_checkpointing: bool,
pub comm_backend: CommBackend,
pub pipeline_schedule: PipelineSchedule,
pub memory_optimization: MemoryOptimization,
}Expand description
3D Parallelism Configuration
Combines data parallelism (DP), model parallelism (MP), and pipeline parallelism (PP) to efficiently scale transformer training across multiple GPUs and nodes.
Key concepts:
- Data Parallelism: Each process has a full copy of the model and trains on different data
- Model Parallelism: Model parameters are split across processes within a layer
- Pipeline Parallelism: Model layers are split across processes, enabling pipeline execution
The total number of processes = dp_size * mp_size * pp_size
Fields§
§dp_size: usizeData parallel group size
mp_size: usizeModel parallel group size
pp_size: usizePipeline parallel group size
num_micro_batches: usizeNumber of micro-batches for pipeline parallelism
gradient_accumulation: boolWhether to use gradient accumulation
accumulation_steps: usizeNumber of gradient accumulation steps
activation_checkpointing: boolWhether to use activation checkpointing
comm_backend: CommBackendCommunication backend preference
pipeline_schedule: PipelineSchedulePipeline scheduling strategy
memory_optimization: MemoryOptimizationMemory optimization level
Trait Implementations§
Source§impl Clone for ParallelismConfig
impl Clone for ParallelismConfig
Source§fn clone(&self) -> ParallelismConfig
fn clone(&self) -> ParallelismConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParallelismConfig
impl Debug for ParallelismConfig
Source§impl Default for ParallelismConfig
impl Default for ParallelismConfig
Source§impl<'de> Deserialize<'de> for ParallelismConfig
impl<'de> Deserialize<'de> for ParallelismConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ParallelismConfig
impl RefUnwindSafe for ParallelismConfig
impl Send for ParallelismConfig
impl Sync for ParallelismConfig
impl Unpin for ParallelismConfig
impl UnsafeUnpin for ParallelismConfig
impl UnwindSafe for ParallelismConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Source§fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
fn save_to_file(&self, path: &Path) -> Result<(), TrustformersError>
Save to file
Source§fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
fn load_from_file(path: &Path) -> Result<Self, TrustformersError>where
Self: Sized,
Load from file
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more