pub struct ParameterPartition {
pub name: String,
pub local_shard: Tensor,
pub partition_info: PartitionInfo,
pub is_gathered: bool,
pub full_parameter: Option<Tensor>,
}Expand description
Parameter partition for ZeRO Stage 3
Fields§
§name: StringParameter name
local_shard: TensorLocal shard of the parameter
partition_info: PartitionInfoPartition metadata
is_gathered: boolWhether this parameter is currently gathered
full_parameter: Option<Tensor>Full parameter (only valid when is_gathered = true)
Implementations§
Source§impl ParameterPartition
impl ParameterPartition
pub fn new( name: String, local_shard: Tensor, partition_info: PartitionInfo, ) -> Self
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage of this partition
Sourcepub fn gather(&mut self, mp_context: &ModelParallelContext) -> Result<()>
pub fn gather(&mut self, mp_context: &ModelParallelContext) -> Result<()>
Gather full parameter from all partitions
Trait Implementations§
Source§impl Clone for ParameterPartition
impl Clone for ParameterPartition
Source§fn clone(&self) -> ParameterPartition
fn clone(&self) -> ParameterPartition
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 moreAuto Trait Implementations§
impl Freeze for ParameterPartition
impl RefUnwindSafe for ParameterPartition
impl Send for ParameterPartition
impl Sync for ParameterPartition
impl Unpin for ParameterPartition
impl UnwindSafe for ParameterPartition
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> 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