pub struct Kime { /* private fields */ }Expand description
A loaded model on a device. Clones share it, and it can be used from any thread.
Implementations§
Source§impl Kime
impl Kime
Sourcepub fn model_id(&self) -> &str
pub fn model_id(&self) -> &str
The model’s name, laya or laya-multilingual for the published checkpoints.
Sourcepub fn decide(&self, req: &Request) -> Result<Response, Error>
pub fn decide(&self, req: &Request) -> Result<Response, Error>
Answers one request.
§Errors
Error::Invalid for a request that does not validate, Error::TooLong for a question
whose options do not fit, and device errors.
Sourcepub fn decide_batch(&self, reqs: &[Request]) -> Result<Vec<Response>, Error>
pub fn decide_batch(&self, reqs: &[Request]) -> Result<Vec<Response>, Error>
Answers many requests, packing all their questions into as few device batches as fit. Each answer is the same bits it would be alone, whatever else is in the batch.
§Errors
As Kime::decide. One bad request fails the whole call.
Sourcepub fn decide_async(&self, req: &Request) -> Decision ⓘ
pub fn decide_async(&self, req: &Request) -> Decision ⓘ
Kime::decide on a thread of its own, for async callers. It works with any executor,
since it needs nothing from one but a waker.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Kime
impl RefUnwindSafe for Kime
impl Send for Kime
impl Sync for Kime
impl Unpin for Kime
impl UnsafeUnpin for Kime
impl UnwindSafe for Kime
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