Skip to content

Commit

Permalink
feat(nmt): Add S2S ST rpc's (#18)
Browse files Browse the repository at this point in the history
* feat(nmt): Add S2S ST rpc's

feat: add imports, comments

chore:

fix: typo

match asr

chore: fix streaming

fix

* fix: add nmtconfig

* fix: field

* fix: decamelcase
  • Loading branch information
junkin authored Jan 11, 2023
1 parent 498c12d commit 4105452
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 3 deletions.
8 changes: 6 additions & 2 deletions riva/proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ cc_grpc_library(
srcs = [":riva_nlp.proto"],
deps = []
)

cc_grpc_library(
name = "riva_grpc_nmt",
srcs = [":riva_nmt.proto"],
deps = []
deps = [
":riva_audio_proto",
":riva_grpc_tts",
":riva_grpc_asr",
]
)


cc_grpc_library(
name = "riva_grpc_health",
srcs = [":health.proto"],
Expand Down
73 changes: 72 additions & 1 deletion riva/proto/riva_nmt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ package nvidia.riva.nmt;

option cc_enable_arenas = true;
option go_package = "nvidia.com/riva_speech";
import "riva/proto/riva_audio.proto";
import "riva/proto/riva_asr.proto";
import "riva/proto/riva_tts.proto";

/*
* RivaTranslation service provides rpcs to translate between languages.
Expand All @@ -21,12 +24,80 @@ service RivaTranslation {

// Translate text to text, from a source to a target language. Currently source and target language fields is required, along with the model name.
// Multiple texts may be passed per request up to the given batch size for the model, which is set at translation pipeline creation time.
rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) {}
rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) {}

// Lists the available language pairs and models names to be used for TranslateText
rpc ListSupportedLanguagePairs(AvailableLanguageRequest) returns (AvailableLanguageResponse) {}

//streaming speech to text translation api.
rpc StreamingTranslateSpeechToText(stream StreamingTranslateSpeechToTextRequest)
returns (stream StreamingTranslateSpeechToTextResponse) {}

rpc StreamingTranslateSpeechToSpeech(stream StreamingTranslateSpeechToSpeechRequest)
returns (stream StreamingTranslateSpeechToSpeechResponse) {}

}

/*
* Configuration for Translate S2S. reuse existing protos from other services.
*/
message StreamingTranslateSpeechToSpeechConfig {
nvidia.riva.asr.StreamingRecognitionConfig asr_config = 1; //from riva_asr.proto
SynthesizeSpeechConfig tts_config = 2;
TranslationConfig translation_config = 3;
}

/*
* Streaming translate speech to speech used to configure the entire pipline for speech translation. This can be
* be backed by a cascade of ASR, NMT, TTS models or an end to end model
*
*/
message StreamingTranslateSpeechToSpeechRequest {
oneof streaming_request {
StreamingTranslateSpeechToSpeechConfig config = 1;
bytes audio_content = 2;
}
}

message TranslationConfig {
//BCP-47 "en-US"
string source_language_code = 1;
string target_language_code = 2;
string model_name = 3;
}

message SynthesizeSpeechConfig {
AudioEncoding encoding = 1;
int32 sample_rate_hz = 2;
string voice_name = 3;
string language_code = 4;
}

/*
*
*/
message StreamingTranslateSpeechToSpeechResponse {
nvidia.riva.tts.SynthesizeSpeechResponse speech = 1; //from riva_tts.proto
}

message StreamingTranslateSpeechToTextRequest {
oneof streaming_request {
StreamingTranslateSpeechToTextConfig config = 1;
bytes audio_content = 2;
}
}

message StreamingTranslateSpeechToTextResponse {

repeated nvidia.riva.asr.StreamingRecognitionResult results = 1; //from riva_asr.proto
}

message StreamingTranslateSpeechToTextConfig {
nvidia.riva.asr.StreamingRecognitionConfig asr_config = 1; //existing ASR config
TranslationConfig translation_config = 2;
}


// request for synchronous translation of each text in texts.
// Available languages can be queried using ListSupportLanguagePairs RPC.
// source and target languages must be specified, are currently two character ISO codes, this will likely change to BCP-47 inline with other Riva Services for GA.
Expand Down

0 comments on commit 4105452

Please sign in to comment.