pub struct DecisionModel { /* private fields */ }Expand description
The full decision model: encoder + head.
Implementations§
Source§impl DecisionModel
impl DecisionModel
Sourcepub fn load(
weights_path: &Path,
encoder_config: &Value,
head_layers: usize,
n_act: usize,
device: Device,
) -> Result<Self>
pub fn load( weights_path: &Path, encoder_config: &Value, head_layers: usize, n_act: usize, device: Device, ) -> Result<Self>
Load a checkpoint from model.safetensors + the encoder config directory.
weights_path— path tomodel.safetensors.encoder_config— parsedencoder/config.json.head_layers—cfg.head_layers.n_act—len(cfg.act_costs) + 1.
Encoder hidden size.
Sourcepub fn embed(
&self,
input_ids: &[Vec<u32>],
attention: &[Vec<u32>],
) -> Result<Vec<Vec<f32>>>
pub fn embed( &self, input_ids: &[Vec<u32>], attention: &[Vec<u32>], ) -> Result<Vec<Vec<f32>>>
Mean-pool the encoder’s last_hidden_state over non-padding tokens.
input_ids/attention are padded rectangular batches. Returns [n, hidden].
Mirrors embed_fn_from_agent in laya/shortlist.py.
Sourcepub fn forward(&self, b: &CollatedBatch) -> Result<ForwardOutput>
pub fn forward(&self, b: &CollatedBatch) -> Result<ForwardOutput>
Run one collated batch. Returns (logits, act_logits) as row-major host vectors:
logits[row][0..kmax] (masked options filled with -1e4) and act_logits[row][0..n_act].
Auto Trait Implementations§
impl !RefUnwindSafe for DecisionModel
impl !UnwindSafe for DecisionModel
impl Freeze for DecisionModel
impl Send for DecisionModel
impl Sync for DecisionModel
impl Unpin for DecisionModel
impl UnsafeUnpin for DecisionModel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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