pub struct SyncModelNotSupported;
Expand description
A marker type for models that do not support synchronous generation.
Trait Implementations§
source§impl SyncModel for SyncModelNotSupported
impl SyncModel for SyncModelNotSupported
source§fn new_session(&self) -> Result<Self::Session>
fn new_session(&self) -> Result<Self::Session>
Create a new session for this model.
source§fn feed_text(
&self,
_session: &mut (),
_prompt: &str,
_: Option<usize>
) -> Result<Logits>
fn feed_text( &self, _session: &mut (), _prompt: &str, _: Option<usize> ) -> Result<Logits>
Run the model synchronously. The model implementation may choose to return only the top k logits.
source§fn feed_tokens(
&self,
_session: &mut (),
_tokens: &[u32],
_: Option<usize>
) -> Result<Logits>
fn feed_tokens( &self, _session: &mut (), _tokens: &[u32], _: Option<usize> ) -> Result<Logits>
Run the model synchronously with a pre-tokenized input. The model implementation may choose to return only the top k logits.
source§fn stop_token(&self) -> Result<u32>
fn stop_token(&self) -> Result<u32>
Get the token ID that represents the end of a sequence.
Auto Trait Implementations§
impl RefUnwindSafe for SyncModelNotSupported
impl Send for SyncModelNotSupported
impl Sync for SyncModelNotSupported
impl Unpin for SyncModelNotSupported
impl UnwindSafe for SyncModelNotSupported
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>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<M> SyncModelExt for Mwhere
M: SyncModel,
impl<M> SyncModelExt for Mwhere
M: SyncModel,
source§fn generate_structured<P: Parser>(
&self,
session: &mut Self::Session,
prompt: impl Display,
parser: P,
parser_state: P::PartialState,
sampler: Arc<Mutex<dyn Sampler>>,
on_token: impl FnMut(String) -> Result<()>
) -> Result<P::Output>
fn generate_structured<P: Parser>( &self, session: &mut Self::Session, prompt: impl Display, parser: P, parser_state: P::PartialState, sampler: Arc<Mutex<dyn Sampler>>, on_token: impl FnMut(String) -> Result<()> ) -> Result<P::Output>
Generate new text with the given prompt that conforms to the given parser.
source§fn stream_text_with_sampler(
&self,
session: &mut Self::Session,
prompt: &str,
max_tokens: Option<u32>,
stop_on: Option<&str>,
sampler: Arc<Mutex<dyn Sampler>>,
on_token: impl FnMut(String) -> Result<ModelFeedback>
) -> Result<()>
fn stream_text_with_sampler( &self, session: &mut Self::Session, prompt: &str, max_tokens: Option<u32>, stop_on: Option<&str>, sampler: Arc<Mutex<dyn Sampler>>, on_token: impl FnMut(String) -> Result<ModelFeedback> ) -> Result<()>
Stream text, calling the on_token callback every time a new token is generated. For some models, this could be used to implement
Model::stream_text_with_sampler
.