DB-GPT icon indicating copy to clipboard operation
DB-GPT copied to clipboard

[Bug] [ChatData] 使用Qwen-14B-Chat进行chatdata,报错

Open erjiguan opened this issue 1 year ago • 4 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Operating system information

Linux

Python version information

3.10

DB-GPT version

main

Related scenes

  • [X] Chat Data
  • [ ] Chat Excel
  • [ ] Chat DB
  • [ ] Chat Knowledge
  • [ ] Model Management
  • [ ] Dashboard
  • [ ] Plugins

Installation Information

Device information

GPU Count: 4 GPU Memory: 16g

Models information

Qwen-14B-Chat

What happened

问题是“一共有多少个学生”,数据库是examples的default_sqlite。 报错: Thoughts: 根据问题,需要查询学生表中学生的数量,因此可以使用SQL的SELECT COUNT()语句进行查询。 SQL: SELECT COUNT() FROM students; 注意:使用了学生表进行查询,因此没有查询到其他的表。另外,根据问题要求,没有限制查询结果的数量,因此没有对查询结果进行限制。

full stream output: Thoughts: 根据问题,需要查询学生表中学生的数量,因此可以使用SQL的SELECT COUNT()语句进行查询。 SQL: SELECT COUNT() FROM students; 注意:使用了学生表进行查询,因此没有查询到其他的表。另外,根据问题要求,没有限制查询结果的数量,因此没有对查询结果进行限制。

model generate_stream params: {'model': 'tongyi_proxyllm', 'prompt': 'You are a SQL expert. ###system:\nGiven an input question, create a syntactically correct sqlite sql.\n\nUnless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most 200 results. \nUse as few tables as possible when querying.\nOnly use the following tables schema to generate sql:\n['students(student_id,student_name,major,year_of_enrollment,student_age);', 'courses(course_id,course_name,credit);', 'scores(student_id,course_id,score,semester);', 'users(user_id,user_name,user_email,registration_date,user_country);', 'products(product_id,product_name,product_price);', 'orders(order_id,user_id,product_id,quantity,order_date);', 'test_cases(case_id,scenario_name,scenario_description,test_question,expected_sql,correct_output);', 'sqlite_sequence(name,seq);']\nBe careful to not query for columns that do not exist. Also, pay attention to which column is in which table.\n\nQuestion: 一共有多少个学生\n\nRespond in JSON format as following format:\n"{\n \"thoughts\": \"thoughts summary to say to user\",\n \"sql\": \"SQL Query to run\"\n}"\nEnsure the response is correct json and can be parsed by Python json.loads\n###human:一共有多少个学生###', 'messages': [ModelMessage(role='system', content='\nGiven an input question, create a syntactically correct sqlite sql.\n\nUnless the user specifies in his question a specific number of examples he wishes to obtain, always limit your query to at most 200 results. \nUse as few tables as possible when querying.\nOnly use the following tables schema to generate sql:\n['students(student_id,student_name,major,year_of_enrollment,student_age);', 'courses(course_id,course_name,credit);', 'scores(student_id,course_id,score,semester);', 'users(user_id,user_name,user_email,registration_date,user_country);', 'products(product_id,product_name,product_price);', 'orders(order_id,user_id,product_id,quantity,order_date);', 'test_cases(case_id,scenario_name,scenario_description,test_question,expected_sql,correct_output);', 'sqlite_sequence(name,seq);']\nBe careful to not query for columns that do not exist. Also, pay attention to which column is in which table.\n\nQuestion: 一共有多少个学生\n\nRespond in JSON format as following format:\n"{\n \"thoughts\": \"thoughts summary to say to user\",\n \"sql\": \"SQL Query to run\"\n}"\nEnsure the response is correct json and can be parsed by Python json.loads\n'), ModelMessage(role='human', content='一共有多少个学生')], 'temperature': 0.5, 'max_new_tokens': 1024, 'stop': '###', 'echo': False, 'span_id': 'be01674b-82d0-487c-96aa-1aa8950896aa:c8185344-7250-4580-9027-64f27030983b'} un_stream ai response: Thoughts: 根据问题,需要查询学生表中学生的数量,因此可以使用SQL的SELECT COUNT()语句进行查询。 SQL: SELECT COUNT() FROM students; 注意:使用了学生表进行查询,因此没有查询到其他的表。另外,根据问题要求,没有限制查询结果的数量,因此没有对查询结果进行限制。 INFO [pilot.out_parser.base] illegal json processing: Thoughts: 根据问题,需要查询学生表中学生的数量,因此可以使用SQL的SELECT COUNT()语句进行查询。 SQL: SELECT COUNT() FROM students; 注意:使用了学生表进行查询,因此没有查询到其他的表。另外,根据问题要求,没有限制查询结果的数量,因此没有对查询结果进行限制。 clean prompt response: Traceback (most recent call last): File "/root/dbgpt/DB-GPT/pilot/scene/base_chat.py", line 261, in nostream_call self.prompt_template.output_parser.parse_prompt_response( File "/root/dbgpt/DB-GPT/pilot/scene/chat_db/auto_execute/out_parser.py", line 29, in parse_prompt_response response = json.loads(clean_str) File "/root/miniconda3/envs/dbgpt_env_1.0/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/root/miniconda3/envs/dbgpt_env_1.0/lib/python3.10/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/root/miniconda3/envs/dbgpt_env_1.0/lib/python3.10/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

ERROR [pilot.scene.base_chat] model response parase faild!Expecting value: line 1 column 1 (char 0)

What you expected to happen

能够正常查询,返回询问的结果

How to reproduce

使用通义千问模型进行chatdata

Additional context

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

erjiguan avatar Nov 05 '23 12:11 erjiguan

同一个数据源,在dashboard是可以正常访问到数据的,但是chatdb和chatdata都不行

erjiguan avatar Nov 05 '23 15:11 erjiguan

碰到一样的问题,用的Baichuan-13B

anfernees-iphone avatar Nov 08 '23 08:11 anfernees-iphone

同样的问题,有什么解决办法吗

Edisonwei54 avatar Nov 20 '23 08:11 Edisonwei54

This issue has been marked as stale, because it has been over 30 days without any activity.

github-actions[bot] avatar Dec 20 '23 21:12 github-actions[bot]

This issue bas been closed, because it has been marked as stale and there has been no activity for over 7 days.

github-actions[bot] avatar Jan 09 '24 21:01 github-actions[bot]