pub struct FairScaleIntegration { /* private fields */ }Expand description
FairScale compatibility integration
Implementations§
Source§impl FairScaleIntegration
impl FairScaleIntegration
Sourcepub fn new(config: FairScaleConfig) -> Self
pub fn new(config: FairScaleConfig) -> Self
Create a new FairScale integration
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> TorshResult<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> TorshResult<Self>
Load configuration from JSON file
Sourcepub fn initialize(
&mut self,
rank: u32,
world_size: u32,
local_rank: u32,
local_size: u32,
) -> TorshResult<()>
pub fn initialize( &mut self, rank: u32, world_size: u32, local_rank: u32, local_size: u32, ) -> TorshResult<()>
Initialize FairScale integration
Sourcepub fn to_fsdp_config(&self) -> TorshResult<FsdpConfig>
pub fn to_fsdp_config(&self) -> TorshResult<FsdpConfig>
Convert FairScale config to ToRSh FSDP config
Sourcepub fn to_pipeline_config(&self) -> TorshResult<Option<PipelineConfig>>
pub fn to_pipeline_config(&self) -> TorshResult<Option<PipelineConfig>>
Convert FairScale config to ToRSh pipeline config
Sourcepub fn config(&self) -> &FairScaleConfig
pub fn config(&self) -> &FairScaleConfig
Get the current configuration
Sourcepub fn stats(&self) -> &FairScaleStats
pub fn stats(&self) -> &FairScaleStats
Get current statistics
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if FairScale integration is initialized
Sourcepub fn world_size(&self) -> u32
pub fn world_size(&self) -> u32
Get world size
Sourcepub fn local_rank(&self) -> u32
pub fn local_rank(&self) -> u32
Get local rank
Sourcepub fn local_size(&self) -> u32
pub fn local_size(&self) -> u32
Get local size
Sourcepub fn fsdp_operation(
&mut self,
operation_name: &str,
parameter_count: usize,
) -> TorshResult<()>
pub fn fsdp_operation( &mut self, operation_name: &str, parameter_count: usize, ) -> TorshResult<()>
Simulate FSDP operation
Sourcepub fn oss_operation(
&mut self,
operation_name: &str,
optimizer_state_size: usize,
) -> TorshResult<()>
pub fn oss_operation( &mut self, operation_name: &str, optimizer_state_size: usize, ) -> TorshResult<()>
Simulate OSS operation
Sourcepub fn record_activation_checkpoint(
&mut self,
layer_name: &str,
memory_saved: usize,
)
pub fn record_activation_checkpoint( &mut self, layer_name: &str, memory_saved: usize, )
Record activation checkpoint
Sourcepub fn record_gradient_scaling_event(&mut self, scale_factor: f32)
pub fn record_gradient_scaling_event(&mut self, scale_factor: f32)
Record gradient scaling event
Sourcepub fn default_config() -> FairScaleConfig
pub fn default_config() -> FairScaleConfig
Create a default FairScale configuration
Sourcepub fn config_with_fsdp_mixed_precision() -> FairScaleConfig
pub fn config_with_fsdp_mixed_precision() -> FairScaleConfig
Create a configuration with FSDP and mixed precision
Sourcepub fn config_with_pipeline_parallelism(stages: u32) -> FairScaleConfig
pub fn config_with_pipeline_parallelism(stages: u32) -> FairScaleConfig
Create a configuration with pipeline parallelism
Auto Trait Implementations§
impl Freeze for FairScaleIntegration
impl RefUnwindSafe for FairScaleIntegration
impl Send for FairScaleIntegration
impl Sync for FairScaleIntegration
impl Unpin for FairScaleIntegration
impl UnsafeUnpin for FairScaleIntegration
impl UnwindSafe for FairScaleIntegration
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> 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