-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Together.ai Support #654
Together.ai Support #654
Conversation
Thanks @minosvasilias ! Just looked through this and it is looking good to me. Could you add a couple unit tests though (one's that get skipped when there is no together account available)? That way we can ensure this continues to work as the code evolves. Thanks again! |
Thanks for reviewing @slundberg ! |
Looks great, thanks again! |
This PR adds a new
TogetherAI
model, implementing:TogetherAICompletion
,TogetherAIChat
,TogetherAIInstruct
In support of together.ai models.
Together has two library implementations: One is the together library, but it also supports the openai library.
This PR uses the
openai
implementation.Because of this, we can largely re-use the existing
OpenAI
classes, with some adjustments:transformers
tokenizers instead oftiktoken
GrammarlessEngine
now acceptsTokenizer
instances as well instead of forcing the use ofGrammarlessTokenizer
, allowing us to create and useTransformersTokenizer
instances insteadTransformersTokenizer
can now download the tokenizer for a HF model by itself, whileTransformersEngine
now only downloads the model and leaves tokenizer initialization to the tokenizer instanceTransformersTokenizer
also gains anignore_bos_token
param, which was necessary to avoid extra tokens inserted into the prompt that are not required for API requestsbase_url
is set to'https://api.together.xyz'
OPENAI_API_KEY
, we useTOGETHERAI_API_KEY
For
TogetherAIInstruct
, i am simply utilizing the chat template with a singleuser
role message, since together.ai will be parsing that in the model-appropriate instruct/chat format behind the scenes.Initially, i was using HF chat templates for the instruction role, however midway through testing the completions endpoint stopped working for models within their chat category, which is why i reverted to above.
I also added a
TogetherAI.ipynb
example notebook.