chromium/third_party/mediapipe/src/mediapipe/tasks/cc/genai/inference/calculators/tokenizer_calculator.proto

// Copyright 2024 The ODML Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package odml.infra.proto;

option java_package = "com.google.odml.infra.proto";
option java_outer_classname = "TokenizerCalculatorOptionsProto";

message TokenizerCalculatorOptions {
  // The maximum number of tokens for the calculator's BERT model. Used
  // if the model's input tensors have static shape.
  int32 max_tokens = 1;

  message TfLiteModelFile {
    reserved 1;

    // The key in the tflite model metadata field, whose corresponding data is
    // a sentence piece model. If not provided, "spm_vocab_model" will be used.
    string spm_model_key_in_metadata = 2;
  }

  oneof model_file {
    // The path to the SentencePiece model file.
    string spm_model_file = 2;

    // Options to load the model from tflite model's metadata
    TfLiteModelFile tflite_model_file = 4;
  }

  // The start token id to be prepended to the input prompt token ids. Note that
  // this should match the setting used while training the model.
  int32 start_token_id = 3;

  reserved 5;
}