Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set gRPC Channel Config for google-cloud-speech Operation (4MB max_receive_message_length limit) #2408

Closed
brianarpie opened this issue Sep 5, 2018 · 3 comments
Assignees
Labels
api: speech Issues related to the Speech-to-Text API. type: question Request for information or clarification. Not an issue.

Comments

@brianarpie
Copy link

I want this functionality for google-cloud-speech:
42ee401

I keep hitting the 4MB limit when enabling speaker diarization for long audio files (because every speech recognition result includes word info from the beginning of the audio).

I got to this point from here:
https://issuetracker.google.com/issues/113502127

I can't find the creation of the grpc channel from google-cloud-speech. If it's not possible, my last resort is to fork grpc and change the defaults from there.

Any help much appreciated, thanks!

@blowmage blowmage self-assigned this Sep 5, 2018
@blowmage blowmage added type: question Request for information or clarification. Not an issue. api: speech Issues related to the Speech-to-Text API. labels Sep 5, 2018
@blowmage
Copy link
Contributor

blowmage commented Sep 5, 2018

Hi @brianarpie, I will show you how to construct a gRPC channel object, so you can specify channel arguments, but I do not think this will help. Speech has some specific content limits and changing the connection configuration won't make the API behave differently.

Here is how to construct a channel object with arguments:

require "google/cloud/speech/v1"

credentials = Google::Cloud::Speech::V1::Credentials.default
host = Google::Cloud::Speech::V1::SpeechClient::SERVICE_ADDRESS
chan_args = { "grpc.max_send_message_length"    => -1,
              "grpc.max_receive_message_length" => -1 }
chan_creds = GRPC::Core::ChannelCredentials.new.compose \
             GRPC::Core::CallCredentials.new credentials.client.updater_proc
channel = GRPC::Core::Channel.new host, chan_args, chan_creds

speech_client = Google::Cloud::Speech::V1.new credentials: channel

@brianarpie
Copy link
Author

Thank you for the swift response @blowmage, this is exactly what I needed !

I'm well aware of the content limits. I'm hitting the 4MB message limit with audio files well below the 180 minute audio length limit. I can transcribe long audio files no problem, except when I enable speaker diarization. I'm fairly certain it's because of the extremely large payload response, due to the way word_info on the speech recognition result / speech recognition alternative is handled as I mentioned.

@brianarpie
Copy link
Author

@blowmage thanks again, your snippet fixed the issue for us.
Watch out for this message limit for long audio files w/ speaker diarization enabled... I'm probably not going to be the last one to hit this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: speech Issues related to the Speech-to-Text API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants