ranker_model.proto 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. //
  5. // Experimental Translation Assist Model to allow/suppress translation prompts.
  6. syntax = "proto2";
  7. option optimize_for = LITE_RUNTIME;
  8. import "nn_classifier.proto";
  9. import "translate_ranker_model.proto";
  10. import "generic_logistic_regression_model.proto";
  11. package assist_ranker;
  12. // Metadata for a ranker model instance. This data describes how the ranker
  13. // model should be interpreted/used.
  14. message RankerModelMetadata {
  15. // An identifier denoting the type or purpose of this model. E.g. "Translate".
  16. optional string name = 1;
  17. // An identifier denoting the specific instance of this model. For example:
  18. // "Experiment B"
  19. optional string label = 2;
  20. // An identifier, typically a URL, denoting the source from which this model
  21. // was obtained. The model referenced with a given source is presumed to be
  22. // immutable; this can be used as a cache control mechanism. If the currently
  23. // configured model source matches the source of a cached model, and the
  24. // cached model has not expired then there is no need to refresh the model.
  25. optional string source = 3;
  26. // The timestamp at which this model was downloaded. This will be set by the
  27. // model loader before it caches the model to disk.
  28. optional int64 last_modified_sec = 4;
  29. // The (optional) number of seconds after which this model should be
  30. // considered expired. If the value is zero or not set, then the cached
  31. // instance of the model never expires. A new download can be triggered by
  32. // changing the configured source URL for the model loader.
  33. optional int64 cache_duration_sec = 5;
  34. // The version of the model. E.g. 20171027.
  35. optional uint32 model_version = 6;
  36. // If true, feature names are hex hashes of the original feature names, and
  37. // hashing must be applied on feature names at prediction time.
  38. optional bool input_features_names_are_hex_hashes = 7;
  39. }
  40. // Defines an envelope/wrapper for general models.
  41. message RankerModelProto {
  42. // Metadata.
  43. optional RankerModelMetadata metadata = 1;
  44. oneof model {
  45. TranslateRankerModel translate = 2;
  46. GenericLogisticRegressionModel logistic_regression = 3;
  47. NNClassifierModel nn_classifier = 4;
  48. }
  49. }