-
Notifications
You must be signed in to change notification settings - Fork 436
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
Conversation
85b3446
to
6942c84
Compare
6942c84
to
d3e7fa2
Compare
There was a problem hiding this 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.
opencompass/models/lagent.py
Outdated
|
||
self.agent = REGISTRY.build(agent_cfg) | ||
|
||
def chat(self, user_input, ice=None) -> Tuple[str, dict]: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
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?
643b13f
to
4e5a49b
Compare
…pass#277) * Support GSM8k evaluation with tools by Lagent and LangChain * Avoid to use MMEngine new feature * update document --------- Co-authored-by: Leymore <[email protected]>
…pass#277) * Support GSM8k evaluation with tools by Lagent and LangChain * Avoid to use MMEngine new feature * update document --------- Co-authored-by: Leymore <[email protected]>
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:
After PR: