_pickle.PicklingError: cannot pickle '_thread.lock' object
Hello Community,I have developed a RAG Chatbot locally (Code can be found here:PrototypGrundschutzChatbot - a Hugging Face Space by MikeMann).Everything works fine on my local machine, but when i move it to spaces and ask a question I get the following error:Traceback (most recent call last):File “/usr/local/lib/python3.10/site-packages/gradio/queueing.py”, line 624, in process_eventsresponse = await route_utils.call_process_api(File “/usr/local/lib/python3.10/site-packages/gradio/route_utils.py”, line 323, in call_process_apioutput = await app.get_blocks().process_api(File “/usr/local/lib/python3.10/site-packages/gradio/blocks.py”, line 2043, in process_apiresult = await self.call_function(File “/usr/local/lib/python3.10/site-packages/gradio/blocks.py”, line 1602, in call_functionprediction = await utils.async_iteration(iterator)File “/usr/local/lib/python3.10/site-packages/gradio/utils.py”, line 710, in async_iterationreturn await anext(iterator)File “/usr/local/lib/python3.10/site-packages/gradio/utils.py”, line 704, inanextreturn await anyio.to_thread.run_sync(File “/usr/local/lib/python3.10/site-packages/anyio/to_thread.py”, line 56, in run_syncreturn await get_async_backend().run_sync_in_worker_thread(File “/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py”, line 2505, in run_sync_in_worker_threadreturn await futureFile “/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py”, line 1005, in runresult = context.run(func, *args)File “/usr/local/lib/python3.10/site-packages/gradio/utils.py”, line 687, in run_sync_iterator_asyncreturn next(iterator)File “/usr/local/lib/python3.10/site-packages/gradio/utils.py”, line 848, in gen_wrapperresponse = next(iterator)File “/home/user/app/app.py”, line 443, in gradiobotbot_response = bot.ragPrompt(history[-1].get(‘content’), reranking, history)File “/usr/local/lib/python3.10/site-packages/spaces/zero/wrappers.py”, line 202, in gradio_handlerworker.arg_queue.put(((args, kwargs), GradioPartialContext.get()))File “/usr/local/lib/python3.10/site-packages/spaces/utils.py”, line 51, in putraise PicklingError(message)_pickle.PicklingError: cannot pickle ‘_thread.lock’ objectDo you have any hints or ideas for me? Thank you in advance.
2024-12-12T10:36:38Z
This looks like a Zero GPU space-related error. You’re more likely to get a reliable response by asking in the community below.In general, you should expect functions with spaces decorators to behave in rather unusual ways.In particular, asynchronous, multi-threaded, multi-process, global variables, and class methods can be troublesome.huggingface.cozero-gpu-explorers/README · DiscussionsWe’re on a journey to advance and democratize artificial intelligence through open source and open science.
2024-12-12T10:37:50Z
Thank you@John6666! I will ask my question there and have a deeper lock into asynchronous behaviour!