-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add support for Azure, Palm, Anthropic, Cohere, Hugging Face Llama2 70b Models - using litellm #202
base: main
Are you sure you want to change the base?
Conversation
@gaotongxiao can you please take a look at this PR when possible ?😊 Happy to add more docs/tests if this initial commit looks good |
we're rolling out support for all Hugging Face chat+text models - happy to add examples of any if there are specific ones you'd like to add support for |
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.
Thanks for the PR! It's a nice feature and I believe that the community would love it. But I think there are still some aspects to improve:
The modification has been made to OpenAI
class, which was initially targeted at OpenAI's API and included some unique features, such as the management of orgs
: https://github.com/InternLM/opencompass/blob/2cba53aef1300ecd6bbef46588f6f6c6b7c17a81/opencompass/models/openai_api.py#L83-L87
and the adjustment of max_out_len
based on the hardcoded model names:
https://github.com/InternLM/opencompass/blob/2cba53aef1300ecd6bbef46588f6f6c6b7c17a81/opencompass/models/openai_api.py#L155-L166
These snippets are not quite compatible with other models and may introduce some unintended bugs in the future. I'd suggest creating a new class named LiteLLM
in litellm_api.py
, and pushing your implementation there, without the snippet I mentioned above and so it becomes general.
If possible, consider adding add a configuration like https://github.com/InternLM/opencompass/blob/main/configs/eval_gpt3.5.py
demonstrating the usage of LiteLLM. You may also want to write a short usage guide at https://github.com/InternLM/opencompass/tree/main/docs/en/advanced_guides.
@@ -24,3 +24,4 @@ tokenizers>=0.13.3 | |||
torch>=1.13.1 | |||
tqdm==4.64.1 | |||
transformers>=4.29.1 | |||
litellm |
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.
We might not add it to dependency - it's a very nice feature, but not a must for many users.
@@ -1,6 +1,7 @@ | |||
import json | |||
import os | |||
import time | |||
from litellm import completion |
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.
Since it won't be a required dependency, the import can be moved to __init__
. It's generally better to ask users to install litellm at runtime.
@ishaan-jaff Hi, thanks for the contribution, any update plan? |
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
This PR adds support for models from all the above mentioned providers using https://github.com/BerriAI/litellm/
All LLM API Models are guaranteed to have the same Input/Output interface
Here's a sample of how it's used:
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: