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

Gpt math solver #991

Draft
wants to merge 136 commits into
base: main
Choose a base branch
from
Draft

Gpt math solver #991

wants to merge 136 commits into from

Conversation

yiranwu0
Copy link
Contributor

@yiranwu0 yiranwu0 commented Apr 12, 2023

Why are these changes needed?

  • When 'messages' in config instead of 'prompt', some messages don't have placeholders, so format it with result error. This change handles this situation
  • Fix typo

Related issue number

Closes #990

Checks

@yiranwu0
Copy link
Contributor Author

@kevin666aa please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@qingyun-wu qingyun-wu self-assigned this Apr 12, 2023
# try to format the message with the data instance
content = m["content"].format(**data_instance)
except Exception:
# if it fails, use the raw message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a warning message here to remind that the program failed to format the message with the data instance and thus raw message is being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might be a long sequence of texts and will be a lot of warning. We should assume that when use inputs messages instead of prompt, these message are less likely containing formatted strings. We can add comments to the doc to explain.

@qingyun-wu
Copy link
Contributor

qingyun-wu commented Apr 12, 2023

Thanks for the contribution. Could you please run pre-commit first: https://microsoft.github.io/FLAML/docs/Contribute#pre-commit to ensure the code passes the "Code formatting" test?

@qingyun-wu
Copy link
Contributor

Add a test case?

@Borda Borda requested a review from qingyun-wu April 13, 2023 15:42
@sonichi
Copy link
Contributor

sonichi commented Apr 16, 2023

Is this PR intended for merging? If not, please make it a draft.

@yiranwu0 yiranwu0 marked this pull request as draft April 16, 2023 17:29
@sonichi sonichi mentioned this pull request Apr 16, 2023
2 tasks
flaml/autogen/math_solver/main.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/main.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/main.py Outdated Show resolved Hide resolved
flaml/autogen/math_utils.py Outdated Show resolved Hide resolved
flaml/autogen/oai/completion.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
@yiranwu0 yiranwu0 requested a review from sonichi April 23, 2023 03:02
@sonichi
Copy link
Contributor

sonichi commented Apr 23, 2023

Please resolve the conflict.

Copy link
Contributor

@sonichi sonichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pre-commit to format the code automatically. Check the PR template to find how to do it.

flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
'model': model,
"max_tokens": max_tokens,
'messages' : [
{"role": "system", "content": "You are a helpful assistant."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about making the prompt before the "Problem:" a system message?

flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
flaml/autogen/math_solver/MathSolver.py Outdated Show resolved Hide resolved
results = selfconsistency.vanilla_voting(responses["responses"], problem['solution'])
print(results['success_vote'], results['votes'])

def tool_voting_one_category(model, problem_set, saving_folder, n=2, n_per_time=1):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skipped

flaml/autogen/math_solver/main.py Outdated Show resolved Hide resolved
flaml/autogen/math_utils.py Outdated Show resolved Hide resolved
flaml/autogen/oai/completion.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

Typo in Auto-Generation.md
3 participants