[Error] Returning a json file as result with gradio

#10
by CharlieAmalet - opened
ZeroGPU Explorers org

i got this:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/whisper/audio.py", line 107, in mel_filters
return torch.from_numpy(f[f"mel_{n_mels}"]).to(device)
File "/usr/local/lib/python3.10/site-packages/numpy/lib/npyio.py", line 251, in getitem
bytes = self.zip.open(key)
File "/usr/local/lib/python3.10/zipfile.py", line 1532, in open
fheader = zef_file.read(sizeFileHeader)
File "/usr/local/lib/python3.10/zipfile.py", line 746, in read
self._file.seek(self._pos)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/spaces/zero/wrappers.py", line 198, in thread_wrapper
res = future.result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/user/app/app.py", line 42, in get_transcript
results = loaded_model.transcribe(audio_path, verbose=True, word_timestamps=True, **options)
File "/usr/local/lib/python3.10/site-packages/whisper/transcribe.py", line 122, in transcribe
mel = log_mel_spectrogram(audio, model.dims.n_mels, padding=N_SAMPLES)
File "/usr/local/lib/python3.10/site-packages/whisper/audio.py", line 151, in log_mel_spectrogram
filters = mel_filters(audio.device, n_mels)
File "/usr/local/lib/python3.10/site-packages/whisper/audio.py", line 106, in mel_filters
with np.load(filters_path, allow_pickle=False) as f:
File "/usr/local/lib/python3.10/site-packages/numpy/lib/npyio.py", line 210, in exit
self.close()
File "/usr/local/lib/python3.10/site-packages/numpy/lib/npyio.py", line 221, in close
self.fid.close()
OSError: [Errno 9] Bad file descriptor
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 501, in call_prediction
output = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 253, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1695, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1235, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2144, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 851, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 692, in wrapper
response = f(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/spaces/zero/wrappers.py", line 160, in gradio_handler
raise res.value
OSError: [Errno 9] Bad file descriptor

ZeroGPU Explorers org

Works now (apparently).. spaces still throw this error though. i don't know why

CharlieAmalet changed discussion status to closed
ZeroGPU Explorers org

ZeroGPU needs to close all file descriptors when starting a GPU worker. If closing one produces an error, it is now ignored that's probably why it now works (lib behind ZeroGPU updates automatically when re-building your Space, so any change in your repo should trigger it)

Sign up or log in to comment