#[non_exhaustive]pub struct SpeculativeDecodingSpec {
pub speculative_token_count: i32,
pub speculation: Option<Speculation>,
/* private fields */
}deployment-resource-pool-service or endpoint-service only.Expand description
Configuration for Speculative Decoding.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.speculative_token_count: i32The number of speculative tokens to generate at each step.
speculation: Option<Speculation>The type of speculation method to use.
Implementations§
Source§impl SpeculativeDecodingSpec
impl SpeculativeDecodingSpec
Sourcepub fn set_speculative_token_count<T: Into<i32>>(self, v: T) -> Self
pub fn set_speculative_token_count<T: Into<i32>>(self, v: T) -> Self
Sets the value of speculative_token_count.
§Example
let x = SpeculativeDecodingSpec::new().set_speculative_token_count(42);Sourcepub fn set_speculation<T: Into<Option<Speculation>>>(self, v: T) -> Self
pub fn set_speculation<T: Into<Option<Speculation>>>(self, v: T) -> Self
Sets the value of speculation.
Note that all the setters affecting speculation are mutually
exclusive.
§Example
use google_cloud_aiplatform_v1::model::speculative_decoding_spec::DraftModelSpeculation;
let x = SpeculativeDecodingSpec::new().set_speculation(Some(
google_cloud_aiplatform_v1::model::speculative_decoding_spec::Speculation::DraftModelSpeculation(DraftModelSpeculation::default().into())));Sourcepub fn draft_model_speculation(&self) -> Option<&Box<DraftModelSpeculation>>
pub fn draft_model_speculation(&self) -> Option<&Box<DraftModelSpeculation>>
The value of speculation
if it holds a DraftModelSpeculation, None if the field is not set or
holds a different branch.
Sourcepub fn set_draft_model_speculation<T: Into<Box<DraftModelSpeculation>>>(
self,
v: T,
) -> Self
pub fn set_draft_model_speculation<T: Into<Box<DraftModelSpeculation>>>( self, v: T, ) -> Self
Sets the value of speculation
to hold a DraftModelSpeculation.
Note that all the setters affecting speculation are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::speculative_decoding_spec::DraftModelSpeculation;
let x = SpeculativeDecodingSpec::new().set_draft_model_speculation(DraftModelSpeculation::default()/* use setters */);
assert!(x.draft_model_speculation().is_some());
assert!(x.ngram_speculation().is_none());Sourcepub fn ngram_speculation(&self) -> Option<&Box<NgramSpeculation>>
pub fn ngram_speculation(&self) -> Option<&Box<NgramSpeculation>>
The value of speculation
if it holds a NgramSpeculation, None if the field is not set or
holds a different branch.
Sourcepub fn set_ngram_speculation<T: Into<Box<NgramSpeculation>>>(self, v: T) -> Self
pub fn set_ngram_speculation<T: Into<Box<NgramSpeculation>>>(self, v: T) -> Self
Sets the value of speculation
to hold a NgramSpeculation.
Note that all the setters affecting speculation are
mutually exclusive.
§Example
use google_cloud_aiplatform_v1::model::speculative_decoding_spec::NgramSpeculation;
let x = SpeculativeDecodingSpec::new().set_ngram_speculation(NgramSpeculation::default()/* use setters */);
assert!(x.ngram_speculation().is_some());
assert!(x.draft_model_speculation().is_none());Trait Implementations§
Source§impl Clone for SpeculativeDecodingSpec
impl Clone for SpeculativeDecodingSpec
Source§fn clone(&self) -> SpeculativeDecodingSpec
fn clone(&self) -> SpeculativeDecodingSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpeculativeDecodingSpec
impl Debug for SpeculativeDecodingSpec
Source§impl Default for SpeculativeDecodingSpec
impl Default for SpeculativeDecodingSpec
Source§fn default() -> SpeculativeDecodingSpec
fn default() -> SpeculativeDecodingSpec
Source§impl Message for SpeculativeDecodingSpec
impl Message for SpeculativeDecodingSpec
Source§impl PartialEq for SpeculativeDecodingSpec
impl PartialEq for SpeculativeDecodingSpec
impl StructuralPartialEq for SpeculativeDecodingSpec
Auto Trait Implementations§
impl Freeze for SpeculativeDecodingSpec
impl RefUnwindSafe for SpeculativeDecodingSpec
impl Send for SpeculativeDecodingSpec
impl Sync for SpeculativeDecodingSpec
impl Unpin for SpeculativeDecodingSpec
impl UnsafeUnpin for SpeculativeDecodingSpec
impl UnwindSafe for SpeculativeDecodingSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request