#[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
pub fn new() -> Self
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more