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

main_gui.py 报错 local variable 'In_context_prompt' referenced before assignment #22

Open
xsw1006931693 opened this issue Jan 27, 2024 · 1 comment

Comments

@xsw1006931693
Copy link

python F:\chat\ChatSQL-main\main_gui.py
Loading checkpoint shards: 14%|████████▏ | 1/7 [00:02<00:12, 2Loading checkpoint shards: 29%|████████████████▎ | 2/7 [00:03<0Loading checkpoint shards: 43%|████████████████████████▍ | 3/7 Loading checkpoint shards: 57%|████████████████████████████████▌ Loading checkpoint shards: 71%|████████████████████████████████████████▋ Loading checkpoint shards: 86%|████████████████████████████████████████████Loading checkpoint shards: 100%|████████████████████████████████████████████Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████| 7/7 [00:13<00:00, 1.89s/it]
F:\chat\ChatSQL-main\main_gui.py:107: GradioDeprecationWarning: The style method is deprecated. Please set these arguments in the constructor instead.
user_input = gr.Textbox(show_label=False, placeholder="Input...", lines=10).style(
Running on local URL: http://127.0.0.1:7860

To create a public link, set share=True in launch().
Traceback (most recent call last):
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\routes.py", line 442, in run_predict
output = await app.get_blocks().process_api(
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\blocks.py", line 1392, in process_api
result = await self.call_function(
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\blocks.py", line 1097, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio_backends_asyncio.py", line 2134, in run_sync_in_worker_thread
return await future
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\anyio_backends_asyncio.py", line 851, in run
result = context.run(func, *args)
File "D:\work\miniconda3\envs\chatsql\lib\site-packages\gradio\utils.py", line 703, in wrapper
response = f(*args, **kwargs)
File "F:\chat\ChatSQL-main\main_gui.py", line 76, in predict
input_prompt = retrieval_related_table(input_prompt, input, history, top_k=3)
File "F:\chat\ChatSQL-main\utils.py", line 28, in retrieval_related_table
input_prompt += In_context_prompt
UnboundLocalError: local variable 'In_context_prompt' referenced before assignment

@uebhh
Copy link

uebhh commented Mar 4, 2024

先输入Hi,问答一下后面不报错。或者在utils.pyde 25行追加语句:
global In_context_prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants