Bytez Model Provider Integration #1787
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there all,
We're Bytez, and we're the largest inference provider on the internet! (We offer inference for 170k+ models.)
We're stuck on step 3 of the integration guide presumably because we need to be added as a provider. (We are unable to use the model mapping api because we don't exist as a provider on your backend.)
This PR allows for Bytez to be used as an inference provider (
bytez-ai
).For the most part, changes are isolated to just the Bytez code with the exception of 5 places:
packages/inference/src/tasks/audio/audioClassification.ts
packages/inference/src/tasks/cv/imageClassification.ts
packages/inference/src/tasks/cv/objectDetection.ts
packages/inference/src/tasks/cv/imageToText.ts
packages/inference/src/providers/hf-inference.ts
The first three have this simple addition to allow for the flexibility to prepare a payload async, which better aligns with how the other tasks are setup.
I'd have dug deeper to bring greater consistency for all of the tasks, but opted for these simple adjustments to see what you guys have to say before making any major changes.
The final task change,
packages/inference/src/tasks/cv/imageToText.ts
follows the same pattern, but also changes the passing of the response to this:It used to be:
There isn't a hook higher up in the call stack (AFAIK) for us to adapt our response to look like an array, so I've opted for this.
To ensure that the existing
hf-inference
provider code still works, I've modified theHFInferenceImageToTextTask
to destructure the array internally, which to me seems more consistent with the general pattern, where the raw response is untouched until it is passed to thegetResponse()
handler.Please let us know if we need to do anything else! 🙏
Also, as a question, is it normal for us to not be able to hit
https://huggingface.co/api/partners/bytez-ai/models
until this PR is accepted and we are on aTeam/Enterprise
plan? FWIW we are on aTeam/Enterprise
plan.If so, we'd like to help you update your docs to make this more explicit!
We look forward to integrating!
Long live huggingface! 🤗