pub struct ModelCheckpoint<T: Float> {
pub epoch: usize,
pub step: usize,
pub model_state: StateDict<T>,
pub optimizer_state: HashMap<String, Vec<u8>>,
pub scheduler_state: HashMap<String, Vec<u8>>,
pub metrics: HashMap<String, f64>,
pub timestamp: u64,
}Expand description
Model checkpoint system モデルチェックポイントシステム
Fields§
§epoch: usize§step: usize§model_state: StateDict<T>§optimizer_state: HashMap<String, Vec<u8>>§scheduler_state: HashMap<String, Vec<u8>>§metrics: HashMap<String, f64>§timestamp: u64Implementations§
Source§impl<T: Float + 'static> ModelCheckpoint<T>
impl<T: Float + 'static> ModelCheckpoint<T>
Sourcepub fn new(epoch: usize, step: usize, model_state: StateDict<T>) -> Self
pub fn new(epoch: usize, step: usize, model_state: StateDict<T>) -> Self
Create new model checkpoint 新しいモデルチェックポイントを作成
Sourcepub fn add_optimizer_state(&mut self, name: String, state: Vec<u8>)
pub fn add_optimizer_state(&mut self, name: String, state: Vec<u8>)
Add optimizer state オプティマイザー状態を追加
Sourcepub fn add_metric(&mut self, name: String, value: f64)
pub fn add_metric(&mut self, name: String, value: f64)
Add training metrics トレーニングメトリクスを追加
Sourcepub fn save_checkpoint<P: AsRef<Path>>(
&self,
path: P,
) -> SerializationResult<()>
pub fn save_checkpoint<P: AsRef<Path>>( &self, path: P, ) -> SerializationResult<()>
Save checkpoint to file チェックポイントをファイルに保存
Sourcepub fn load_checkpoint<P: AsRef<Path>>(path: P) -> SerializationResult<Self>
pub fn load_checkpoint<P: AsRef<Path>>(path: P) -> SerializationResult<Self>
Load checkpoint from file ファイルからチェックポイントを読み込み
Trait Implementations§
Source§impl<T: Clone + Float> Clone for ModelCheckpoint<T>
impl<T: Clone + Float> Clone for ModelCheckpoint<T>
Source§fn clone(&self) -> ModelCheckpoint<T>
fn clone(&self) -> ModelCheckpoint<T>
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<T: Float + 'static> Loadable for ModelCheckpoint<T>
impl<T: Float + 'static> Loadable for ModelCheckpoint<T>
Source§fn load_binary(data: &[u8]) -> SerializationResult<Self>
fn load_binary(data: &[u8]) -> SerializationResult<Self>
Load object from binary format
バイナリ形式からオブジェクトを読み込み
Source§fn expected_type_id() -> &'static str
fn expected_type_id() -> &'static str
Get expected type identifier
期待されるタイプ識別子を取得
Source§fn validate_version(version: &str) -> SerializationResult<()>
fn validate_version(version: &str) -> SerializationResult<()>
Validate version compatibility
バージョン互換性を検証
Source§impl<T: Float + 'static> Saveable for ModelCheckpoint<T>
impl<T: Float + 'static> Saveable for ModelCheckpoint<T>
Source§fn save_binary(&self) -> SerializationResult<Vec<u8>>
fn save_binary(&self) -> SerializationResult<Vec<u8>>
Save object to binary format
オブジェクトをバイナリ形式で保存
Auto Trait Implementations§
impl<T> Freeze for ModelCheckpoint<T>
impl<T> RefUnwindSafe for ModelCheckpoint<T>where
T: RefUnwindSafe,
impl<T> Send for ModelCheckpoint<T>where
T: Send,
impl<T> Sync for ModelCheckpoint<T>where
T: Sync,
impl<T> Unpin for ModelCheckpoint<T>
impl<T> UnwindSafe for ModelCheckpoint<T>where
T: RefUnwindSafe,
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> 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