ContextLab / quail

A python toolbox for analyzing and plotting free recall data
http://cdl-quail.readthedocs.io/en/latest/
MIT License
20 stars 10 forks source link

Operation was attempted past the valid range #114

Closed jamalw closed 3 years ago

jamalw commented 5 years ago

I have a new problem. After converting my wav files to mp3s and then back to wavs most of them are now able to be decoded (although the exact fix that occurred during the conversion is unknown). However, several files remain broken and I get a new error for these files when using the decode_speech function:

Decoding file 1 of 1 Audio clip is longer than 1 minute. Splitting into 2 one minute segments...

_Rendezvous Traceback (most recent call last) /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/retry.py in inner(*args) 120 to_call = add_timeout_arg(a_func, timeout, *kwargs) --> 121 return to_call(args) 122 except Exception as exception: # pylint: disable=broad-except

/Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/retry.py in inner(args) 67 updated_args = args + (timeout,) ---> 68 return a_func(updated_args, **kwargs) 69

/Users/jamalw/anaconda3/lib/python3.6/site-packages/grpc/_channel.py in call(self, request, timeout, metadata, credentials) 531 state, call, = self._blocking(request, timeout, metadata, credentials) --> 532 return _end_unary_response_blocking(state, call, False, None) 533

/Users/jamalw/anaconda3/lib/python3.6/site-packages/grpc/_channel.py in _end_unary_response_blocking(state, call, with_call, deadline) 465 else: --> 466 raise _Rendezvous(state, None, None, deadline) 467

_Rendezvous: <_Rendezvous of RPC that terminated with: status = StatusCode.OUT_OF_RANGE details = "Operation was attempted past the valid range." debug_error_string = "{"created":"@1539110723.536016000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1099,"grpc_message":"Operation was attempted past the valid range.","grpc_status":11}"

During handling of the above exception, another exception occurred:

RetryError Traceback (most recent call last)

in () 12 rec = [] 13 subj_id = subj_dir[0].split("/data/",1)[1] ---> 14 rec.append(quail.decode_speech(datadir + subj_id + '/fix/mono.wav', keypath='/Users/jamalw/Desktop/PNI/music_context_reinstatement/music-context-reinstatement-9d76d8344a75.json')) /Users/jamalw/anaconda3/lib/python3.6/site-packages/quail/decode_speech.py in decode_speech(path, keypath, save, speech_context, sample_rate, max_alternatives, language_code, enable_word_time_offsets, return_raw) 223 # decode file 224 results = decode_file(f, client, speech_context, sample_rate, --> 225 max_alternatives, enable_word_time_offsets) 226 227 # parsing response /Users/jamalw/anaconda3/lib/python3.6/site-packages/quail/decode_speech.py in decode_file(file_path, client, speech_context, sample_rate, max_alternatives, enable_word_time_offsets) 141 results = [] 142 for idx, chunk in enumerate(audio_chunks): --> 143 results.append(recognize(chunk, file_path+str(idx))) 144 145 # return list of results /Users/jamalw/anaconda3/lib/python3.6/site-packages/quail/decode_speech.py in recognize(chunk, file_path) 107 # run speech decoding 108 try: --> 109 result = client.recognize(opts, sample) 110 except ValueError as e: 111 print(e) /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/cloud/gapic/speech/v1/speech_client.py in recognize(self, config, audio, options) 199 """ 200 request = cloud_speech_pb2.RecognizeRequest(config=config, audio=audio) --> 201 return self._recognize(request, options) 202 203 def long_running_recognize(self, config, audio, options=None): /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/api_callable.py in inner(request, options) 450 func, this_settings.timeout, **this_settings.kwargs) 451 api_call = _catch_errors(api_call, gax.config.API_ERRORS) --> 452 return api_caller(api_call, this_settings, request) 453 454 if settings.page_descriptor: /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/api_callable.py in base_caller(api_call, _, *args) 436 def base_caller(api_call, _, *args): 437 """Simply call api_call and ignore settings.""" --> 438 return api_call(*args) 439 440 def inner(request, options=None): /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/api_callable.py in inner(*args, **kwargs) 374 """Wraps specified exceptions""" 375 try: --> 376 return a_func(*args, **kwargs) 377 # pylint: disable=catching-non-exception 378 except tuple(to_catch) as exception: /Users/jamalw/anaconda3/lib/python3.6/site-packages/google/gax/retry.py in inner(*args) 125 raise errors.RetryError( 126 'Exception occurred in retry method that was not' --> 127 ' classified as transient', exception) 128 129 exc = errors.RetryError( RetryError: RetryError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with: status = StatusCode.OUT_OF_RANGE details = "Operation was attempted past the valid range." debug_error_string = "{"created":"@1539110723.536016000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1099,"grpc_message":"Operation was attempted past the valid range.","grpc_status":11}" >)
jeremymanning commented 5 years ago

woah-- @jamalw quit breaking our toolbox, would you?!

to help us figure this out, can you attach a sample file that works via your previous method (wav --> mp3 --> wav), and another processed in the same way that is giving you the error above?

and can we safely assume nothing has changed with respect to pip freeze on your setup?

jamalw commented 5 years ago

Lol. I've attached a zip file containing the two files. The naming should make it obvious which one is which (works.wav and does_not_work.wav). Also, nothing has changed on my pip freeze setup.

Archive.zip

jamalw commented 5 years ago

Wondering if you guys figured anything out regarding this error yet. I finally got my analysis pipeline up and running for the 5 subjects who's files were not corrupted but I still have 22 more subjects I'd like to analyze. I'm hoping there's some trivial solution similar to my last issue (just convert to mp3 and back to wav) but I understand if this is a different type of bug altogether. Thanks again for looking into this!

jeremymanning commented 3 years ago

@jamalw I think this should (finally!) be fixed in our latest release, in case you are still encountering this issue...

jamalw commented 3 years ago

Thanks Jeremy!

On Fri, Jun 4, 2021 at 12:33 PM Jeremy Manning @.***> wrote:

@jamalw https://github.com/jamalw I think this should (finally!) be fixed in our latest release, in case you are still encountering this issue...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ContextLab/quail/issues/114#issuecomment-854860834, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGZDKMTS3RNPJVWN5T4U3TTRD54XANCNFSM4F2PTXHQ .