pub struct LearningLifecycleHook { /* private fields */ }Expand description
Learning を自動実行する LifecycleHook
Swarm 終了時に TrainTrigger をチェックし、条件を満たせば Learn を実行。
§Eval カウント
内部で Eval 実行回数をカウントし、CountTrigger と連携。 例: 10 回の Eval 後に Learn を実行。
§非同期 Sink との違い
| 項目 | LearningLifecycleHook | LearningSink (pipeline) |
|---|---|---|
| 呼び出し | Orchestrator 終了時 | ファイル監視イベント時 |
| 実行モデル | 同期 callback | async trait |
| 用途 | Eval 終了後の即時学習 | Daemon モードでの継続学習 |
§将来拡張
- IPC/WebSocket で外部 Learner プロセスと通信
- DPO 学習の自動実行
Implementations§
Source§impl LearningLifecycleHook
impl LearningLifecycleHook
Sourcepub fn new(learning_path: impl Into<PathBuf>) -> Self
pub fn new(learning_path: impl Into<PathBuf>) -> Self
新しい LearningLifecycleHook を作成
デフォルトは AlwaysTrigger(毎回 Learn 実行)。
Sourcepub fn with_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
pub fn with_trigger(self, trigger: Arc<dyn TrainTrigger>) -> Self
Sourcepub fn with_scenario(self, scenario: impl Into<String>) -> Self
pub fn with_scenario(self, scenario: impl Into<String>) -> Self
シナリオ名を設定
Sourcepub fn with_learn_callback<F>(self, callback: F) -> Self
pub fn with_learn_callback<F>(self, callback: F) -> Self
Learn 実行コールバックを設定
デフォルトの Learn 実行ロジックをオーバーライド。 DPO 学習など、カスタムの学習処理を実行できる。
Sourcepub fn eval_count_handle(&self) -> Arc<AtomicUsize>
pub fn eval_count_handle(&self) -> Arc<AtomicUsize>
外部から eval_count を共有するための Arc を取得
複数の Orchestrator 間で Eval カウントを共有する場合に使用。
共有された eval_count を設定
Sourcepub fn current_eval_count(&self) -> usize
pub fn current_eval_count(&self) -> usize
現在の Eval カウントを取得
Sourcepub fn learning_path(&self) -> &PathBuf
pub fn learning_path(&self) -> &PathBuf
Learning パスを取得
Trait Implementations§
Source§impl LifecycleHook for LearningLifecycleHook
impl LifecycleHook for LearningLifecycleHook
Source§fn on_terminate(&mut self, state: &SwarmState, result: &SwarmResult)
fn on_terminate(&mut self, state: &SwarmState, result: &SwarmResult)
Swarm 終了時に呼ばれる Read more
Auto Trait Implementations§
impl Freeze for LearningLifecycleHook
impl !RefUnwindSafe for LearningLifecycleHook
impl Send for LearningLifecycleHook
impl Sync for LearningLifecycleHook
impl Unpin for LearningLifecycleHook
impl !UnwindSafe for LearningLifecycleHook
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