ModelCheckpoint

Struct ModelCheckpoint 

Source
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: u64

Implementations§

Source§

impl<T: Float + 'static> ModelCheckpoint<T>

Source

pub fn new(epoch: usize, step: usize, model_state: StateDict<T>) -> Self

Create new model checkpoint 新しいモデルチェックポイントを作成

Source

pub fn add_optimizer_state(&mut self, name: String, state: Vec<u8>)

Add optimizer state オプティマイザー状態を追加

Source

pub fn add_metric(&mut self, name: String, value: f64)

Add training metrics トレーニングメトリクスを追加

Source

pub fn save_checkpoint<P: AsRef<Path>>( &self, path: P, ) -> SerializationResult<()>

Save checkpoint to file チェックポイントをファイルに保存

Source

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>

Source§

fn clone(&self) -> ModelCheckpoint<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Float> Debug for ModelCheckpoint<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Float + 'static> Loadable for ModelCheckpoint<T>

Source§

fn load_binary(data: &[u8]) -> SerializationResult<Self>

Load object from binary format バイナリ形式からオブジェクトを読み込み
Source§

fn expected_type_id() -> &'static str

Get expected type identifier 期待されるタイプ識別子を取得
Source§

fn validate_version(version: &str) -> SerializationResult<()>

Validate version compatibility バージョン互換性を検証
Source§

impl<T: Float + 'static> Saveable for ModelCheckpoint<T>

Source§

fn save_binary(&self) -> SerializationResult<Vec<u8>>

Save object to binary format オブジェクトをバイナリ形式で保存
Source§

fn type_id(&self) -> &'static str

Get object type identifier オブジェクトタイプ識別子を取得
Source§

fn metadata(&self) -> HashMap<String, String>

Get metadata for object オブジェクトのメタデータを取得
Source§

fn version(&self) -> String

Get version information バージョン情報を取得

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V