From f2b7249af03c54843adca79f9529c57937b8ef32 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:26:58 -0800 Subject: [PATCH] feat: Add speculative decoding spec to DeployedModel proto (#8035) PiperOrigin-RevId: 719114015 Source-Link: https://github.com/googleapis/googleapis/commit/8ae42f34e12cb8ab1ca66290322f4c8662c71a0a Source-Link: https://github.com/googleapis/googleapis-gen/commit/02635deac0f24ff83b042b3a904808e488984b01 Copy-Tag: eyJwIjoiQWlQbGF0Zm9ybS8uT3dsQm90LnlhbWwiLCJoIjoiMDI2MzVkZWFjMGYyNGZmODNiMDQyYjNhOTA0ODA4ZTQ4ODk4NGIwMSJ9 --- AiPlatform/metadata/V1/Endpoint.php | Bin 4778 -> 5284 bytes AiPlatform/src/V1/DeployedModel.php | 44 ++++++ AiPlatform/src/V1/SpeculativeDecodingSpec.php | 142 ++++++++++++++++++ .../DraftModelSpeculation.php | 69 +++++++++ .../NgramSpeculation.php | 82 ++++++++++ 5 files changed, 337 insertions(+) create mode 100644 AiPlatform/src/V1/SpeculativeDecodingSpec.php create mode 100644 AiPlatform/src/V1/SpeculativeDecodingSpec/DraftModelSpeculation.php create mode 100644 AiPlatform/src/V1/SpeculativeDecodingSpec/NgramSpeculation.php diff --git a/AiPlatform/metadata/V1/Endpoint.php b/AiPlatform/metadata/V1/Endpoint.php index cbcb49763cfa0a212a186b02cfe9c4cd9534617c..309d31b475c1c8a194e31334c00c3f25b6104228 100644 GIT binary patch delta 447 zcmZ3bxB@4?u1uo6W7g=OBN3wipW4yOHkb5h$s!%kSWN|@ia%oOtNoHAUd`fC^ zeoAIudOS!_LQa8EgWJe>as#)FOfW)~3sezE$cg!ZBjaK=ex}K`g8q|P1ug7mGINRJ zP%Mo1c=J1GWTgbAFx#6WA_KkX=4FwClNm^!kFd!d2wwc`yhiatY?8 z7bWJR7|0AZ&;?{*JzRNNDzfAC{6M@Smz delta 45 zcmV+|0Mh@YDXJx~IRpfy911Cu(F7c`Sp@e60fDno3$+8IV-Et8vk^CwV-ZiYh7%qE DUMCL1 diff --git a/AiPlatform/src/V1/DeployedModel.php b/AiPlatform/src/V1/DeployedModel.php index 3f33119f03f8..18123cd20d99 100644 --- a/AiPlatform/src/V1/DeployedModel.php +++ b/AiPlatform/src/V1/DeployedModel.php @@ -149,6 +149,12 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * Generated from protobuf field map system_labels = 28; */ private $system_labels; + /** + * Optional. Spec for configuring speculative decoding. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec speculative_decoding_spec = 30 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $speculative_decoding_spec = null; protected $prediction_resources; /** @@ -245,6 +251,8 @@ class DeployedModel extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\MapField $system_labels * System labels to apply to Model Garden deployments. * System labels are managed by Google for internal use only. + * @type \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec $speculative_decoding_spec + * Optional. Spec for configuring speculative decoding. * } */ public function __construct($data = NULL) { @@ -867,6 +875,42 @@ public function setSystemLabels($var) return $this; } + /** + * Optional. Spec for configuring speculative decoding. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec speculative_decoding_spec = 30 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec|null + */ + public function getSpeculativeDecodingSpec() + { + return $this->speculative_decoding_spec; + } + + public function hasSpeculativeDecodingSpec() + { + return isset($this->speculative_decoding_spec); + } + + public function clearSpeculativeDecodingSpec() + { + unset($this->speculative_decoding_spec); + } + + /** + * Optional. Spec for configuring speculative decoding. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec speculative_decoding_spec = 30 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec $var + * @return $this + */ + public function setSpeculativeDecodingSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec::class); + $this->speculative_decoding_spec = $var; + + return $this; + } + /** * @return string */ diff --git a/AiPlatform/src/V1/SpeculativeDecodingSpec.php b/AiPlatform/src/V1/SpeculativeDecodingSpec.php new file mode 100644 index 000000000000..5dbb14c34336 --- /dev/null +++ b/AiPlatform/src/V1/SpeculativeDecodingSpec.php @@ -0,0 +1,142 @@ +google.cloud.aiplatform.v1.SpeculativeDecodingSpec + */ +class SpeculativeDecodingSpec extends \Google\Protobuf\Internal\Message +{ + /** + * The number of speculative tokens to generate at each step. + * + * Generated from protobuf field int32 speculative_token_count = 1; + */ + protected $speculative_token_count = 0; + protected $speculation; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\DraftModelSpeculation $draft_model_speculation + * draft model speculation. + * @type \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\NgramSpeculation $ngram_speculation + * N-Gram speculation. + * @type int $speculative_token_count + * The number of speculative tokens to generate at each step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Aiplatform\V1\Endpoint::initOnce(); + parent::__construct($data); + } + + /** + * draft model speculation. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec.DraftModelSpeculation draft_model_speculation = 2; + * @return \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\DraftModelSpeculation|null + */ + public function getDraftModelSpeculation() + { + return $this->readOneof(2); + } + + public function hasDraftModelSpeculation() + { + return $this->hasOneof(2); + } + + /** + * draft model speculation. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec.DraftModelSpeculation draft_model_speculation = 2; + * @param \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\DraftModelSpeculation $var + * @return $this + */ + public function setDraftModelSpeculation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\DraftModelSpeculation::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * N-Gram speculation. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec.NgramSpeculation ngram_speculation = 3; + * @return \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\NgramSpeculation|null + */ + public function getNgramSpeculation() + { + return $this->readOneof(3); + } + + public function hasNgramSpeculation() + { + return $this->hasOneof(3); + } + + /** + * N-Gram speculation. + * + * Generated from protobuf field .google.cloud.aiplatform.v1.SpeculativeDecodingSpec.NgramSpeculation ngram_speculation = 3; + * @param \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\NgramSpeculation $var + * @return $this + */ + public function setNgramSpeculation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\SpeculativeDecodingSpec\NgramSpeculation::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The number of speculative tokens to generate at each step. + * + * Generated from protobuf field int32 speculative_token_count = 1; + * @return int + */ + public function getSpeculativeTokenCount() + { + return $this->speculative_token_count; + } + + /** + * The number of speculative tokens to generate at each step. + * + * Generated from protobuf field int32 speculative_token_count = 1; + * @param int $var + * @return $this + */ + public function setSpeculativeTokenCount($var) + { + GPBUtil::checkInt32($var); + $this->speculative_token_count = $var; + + return $this; + } + + /** + * @return string + */ + public function getSpeculation() + { + return $this->whichOneof("speculation"); + } + +} + diff --git a/AiPlatform/src/V1/SpeculativeDecodingSpec/DraftModelSpeculation.php b/AiPlatform/src/V1/SpeculativeDecodingSpec/DraftModelSpeculation.php new file mode 100644 index 000000000000..8096e48ea4dd --- /dev/null +++ b/AiPlatform/src/V1/SpeculativeDecodingSpec/DraftModelSpeculation.php @@ -0,0 +1,69 @@ +google.cloud.aiplatform.v1.SpeculativeDecodingSpec.DraftModelSpeculation + */ +class DraftModelSpeculation extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the draft model. + * + * Generated from protobuf field string draft_model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $draft_model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $draft_model + * Required. The resource name of the draft model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Aiplatform\V1\Endpoint::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the draft model. + * + * Generated from protobuf field string draft_model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDraftModel() + { + return $this->draft_model; + } + + /** + * Required. The resource name of the draft model. + * + * Generated from protobuf field string draft_model = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDraftModel($var) + { + GPBUtil::checkString($var, True); + $this->draft_model = $var; + + return $this; + } + +} + + diff --git a/AiPlatform/src/V1/SpeculativeDecodingSpec/NgramSpeculation.php b/AiPlatform/src/V1/SpeculativeDecodingSpec/NgramSpeculation.php new file mode 100644 index 000000000000..7fd31b4bfefb --- /dev/null +++ b/AiPlatform/src/V1/SpeculativeDecodingSpec/NgramSpeculation.php @@ -0,0 +1,82 @@ +google.cloud.aiplatform.v1.SpeculativeDecodingSpec.NgramSpeculation + */ +class NgramSpeculation extends \Google\Protobuf\Internal\Message +{ + /** + * The number of last N input tokens used as ngram to search/match + * against the previous prompt sequence. + * This is equal to the N in N-Gram. + * The default value is 3 if not specified. + * + * Generated from protobuf field int32 ngram_size = 1; + */ + protected $ngram_size = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $ngram_size + * The number of last N input tokens used as ngram to search/match + * against the previous prompt sequence. + * This is equal to the N in N-Gram. + * The default value is 3 if not specified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Aiplatform\V1\Endpoint::initOnce(); + parent::__construct($data); + } + + /** + * The number of last N input tokens used as ngram to search/match + * against the previous prompt sequence. + * This is equal to the N in N-Gram. + * The default value is 3 if not specified. + * + * Generated from protobuf field int32 ngram_size = 1; + * @return int + */ + public function getNgramSize() + { + return $this->ngram_size; + } + + /** + * The number of last N input tokens used as ngram to search/match + * against the previous prompt sequence. + * This is equal to the N in N-Gram. + * The default value is 3 if not specified. + * + * Generated from protobuf field int32 ngram_size = 1; + * @param int $var + * @return $this + */ + public function setNgramSize($var) + { + GPBUtil::checkInt32($var); + $this->ngram_size = $var; + + return $this; + } + +} + +