Internal change
PiperOrigin-RevId: 481227358
This commit is contained in:
parent
364b8e8106
commit
42543f7ad6
|
@ -52,7 +52,7 @@ proto::BaseOptions ConvertBaseOptionsToProto(BaseOptions* base_options) {
|
|||
}
|
||||
switch (base_options->delegate) {
|
||||
case BaseOptions::Delegate::CPU:
|
||||
base_options_proto.mutable_acceleration()->mutable_xnnpack();
|
||||
base_options_proto.mutable_acceleration()->mutable_tflite();
|
||||
break;
|
||||
case BaseOptions::Delegate::GPU:
|
||||
base_options_proto.mutable_acceleration()->mutable_gpu();
|
||||
|
|
|
@ -122,6 +122,9 @@ class InferenceSubgraph : public Subgraph {
|
|||
case Acceleration::kGpu:
|
||||
delegate.mutable_gpu()->CopyFrom(acceleration.gpu());
|
||||
break;
|
||||
case Acceleration::kTflite:
|
||||
delegate.mutable_tflite()->CopyFrom(acceleration.tflite());
|
||||
break;
|
||||
case Acceleration::DELEGATE_NOT_SET:
|
||||
// Deafult inference calculator setting.
|
||||
break;
|
||||
|
@ -177,9 +180,9 @@ GenericNode& ModelTaskGraph::AddInference(
|
|||
->CopyFrom(acceleration);
|
||||
// When the model resources tag is available, the ModelResourcesCalculator
|
||||
// will retrieve the cached model resources from the graph service by tag.
|
||||
// Otherwise, provides the exteranal file and asks the
|
||||
// Otherwise, provides the external file and asks the
|
||||
// ModelResourcesCalculator to create a local model resources in its
|
||||
// Calcualtor::Open().
|
||||
// Calculator::Open().
|
||||
if (!model_resources.GetTag().empty()) {
|
||||
inference_subgraph_opts.set_model_resources_tag(model_resources.GetTag());
|
||||
} else {
|
||||
|
|
|
@ -32,5 +32,6 @@ message Acceleration {
|
|||
oneof delegate {
|
||||
mediapipe.InferenceCalculatorOptions.Delegate.Xnnpack xnnpack = 1;
|
||||
mediapipe.InferenceCalculatorOptions.Delegate.Gpu gpu = 2;
|
||||
mediapipe.InferenceCalculatorOptions.Delegate.TfLite tflite = 4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ TEST_F(CreateFromOptionsTest, FailsWithSelectiveOpResolverMissingOps) {
|
|||
// interpreter errors (e.g., "Encountered unresolved custom op").
|
||||
EXPECT_EQ(object_detector.status().code(), absl::StatusCode::kInternal);
|
||||
EXPECT_THAT(object_detector.status().message(),
|
||||
HasSubstr("interpreter_builder(&interpreter) == kTfLiteOk"));
|
||||
HasSubstr("interpreter->AllocateTensors() == kTfLiteOk"));
|
||||
}
|
||||
|
||||
TEST_F(CreateFromOptionsTest, FailsWithMissingModel) {
|
||||
|
|
6
mediapipe/tasks/testdata/text/BUILD
vendored
6
mediapipe/tasks/testdata/text/BUILD
vendored
|
@ -26,6 +26,7 @@ mediapipe_files(srcs = [
|
|||
"30k-clean.model",
|
||||
"albert_with_metadata.tflite",
|
||||
"bert_text_classifier.tflite",
|
||||
"mobilebert_embedding_with_metadata.tflite",
|
||||
"mobilebert_with_metadata.tflite",
|
||||
"test_model_text_classifier_bool_output.tflite",
|
||||
"test_model_text_classifier_with_regex_tokenizer.tflite",
|
||||
|
@ -83,3 +84,8 @@ filegroup(
|
|||
name = "bert_text_classifier_models",
|
||||
srcs = ["bert_text_classifier.tflite"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "mobilebert_embedding_model",
|
||||
srcs = ["mobilebert_embedding_with_metadata.tflite"],
|
||||
)
|
||||
|
|
6
third_party/external_files.bzl
vendored
6
third_party/external_files.bzl
vendored
|
@ -340,6 +340,12 @@ def external_files():
|
|||
urls = ["https://storage.googleapis.com/mediapipe-assets/left_hands.jpg?generation=1661875796949017"],
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "com_google_mediapipe_mobilebert_embedding_with_metadata_tflite",
|
||||
sha256 = "fa47142dcc6f446168bc672f2df9605b6da5d0c0d6264e9be62870282365b95c",
|
||||
urls = ["https://storage.googleapis.com/mediapipe-assets/mobilebert_embedding_with_metadata.tflite?generation=1664516086197724"],
|
||||
)
|
||||
|
||||
http_file(
|
||||
name = "com_google_mediapipe_mobilebert_vocab_txt",
|
||||
sha256 = "07eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3",
|
||||
|
|
Loading…
Reference in New Issue
Block a user