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

Support GSM8k evaluation with tools by Lagent and LangChain #277

Merged
merged 5 commits into from
Sep 22, 2023

Conversation

mzr1996
Copy link
Collaborator

@mzr1996 mzr1996 commented Aug 28, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here and update the documentation.

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

@gaotongxiao
Copy link
Collaborator

/
/
Thanks for your contribution! The linting test seems not passed.

image

You can install pre-commit hooks to automatically fix this issue:

pip install -U pre-commit
pre-commit install
pre-commit run --all-files
git add --update
git commit

@Leymore Leymore marked this pull request as draft August 29, 2023 13:50
@mzr1996 mzr1996 changed the title [WIP] Support GSM8k evaluation with tools by Lagent and LangChain Support GSM8k evaluation with tools by Lagent and LangChain Aug 31, 2023
@mzr1996 mzr1996 marked this pull request as ready for review August 31, 2023 09:14
@Leymore Leymore assigned mzr1996 and unassigned Leymore Sep 11, 2023
Copy link
Collaborator

@gaotongxiao gaotongxiao left a comment

Choose a reason for hiding this comment

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

Overall good, but the documentation and docstring are urgently needed.


self.agent = REGISTRY.build(agent_cfg)

def chat(self, user_input, ice=None) -> Tuple[str, dict]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

ice is not used? Same for langchain

REGISTRY = Registry('helper')


class LagentAgent:
Copy link
Collaborator

Choose a reason for hiding this comment

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

May need a BaseAgent - if the design is general enough

Copy link
Collaborator

Choose a reason for hiding this comment

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

Need docstr for the class (same for langchain)

super().__init__()
self.fail_words = fail_words

def score(self, predictions: List):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def score(self, predictions: List):
def score(self, predictions: List, references: List):

Following the protocol though it's not used

highest_idx = np.where(scores == scores.max())[0].tolist()
return random.choice(highest_idx)

def _openai_function(self, msg: str, max_out_len: int, functions: dict,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can it be implemented as an OpenAIFunc wrapper?

@Leymore Leymore self-requested a review September 14, 2023 15:55
@Leymore Leymore merged commit 0f2c388 into main Sep 22, 2023
5 checks passed
go-with-me000 pushed a commit to go-with-me000/opencompass that referenced this pull request Oct 9, 2023
…pass#277)

* Support GSM8k evaluation with tools by Lagent and LangChain

* Avoid to use MMEngine new feature

* update document

---------

Co-authored-by: Leymore <zfz-960727@163.com>
@Leymore Leymore deleted the mzr/support-agents branch January 8, 2024 08:34
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.

None yet

3 participants