-
Notifications
You must be signed in to change notification settings - Fork 353
Integrate Nscale-cloud into HuggingFace inference #1260
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
Conversation
Hey @nbarr07 , thanks for your PR :) Even though we are looking forward to integrate new providers, we'll have to hold on for a bit on this one. Integrating a new provider takes time and effort on our side to make things right so for now we've decided to focus on the existing ones. Will let you know when we are ready to move forward! 🤗 |
Hi @julien-c , thanks for the heads-up about the refactoring, if there's anything we can do on our side let me know! |
Hi @nbarr07, import * as NScaleCloud from "../providers/nscale-cloud";
...
export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask, TaskProviderHelper>>> = {
...
"nscale-cloud": {
"text-to-image": new NScaleCloud.NScaleCloudTextToImageTask(),
"conversational": new NScaleCloud.NScaleCloudConversationalTask(),
"text-generation": new NScaleCloud.NScaleCloudTextGenerationTask(),
},
},
... 2 - Update import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper";
const NSCALE_API_BASE_URL = "https://inference.api.nscale.com";
export class NScaleCloudConversationalTask extends BaseConversationalTask {
constructor() {
super("nscale-cloud", NSCALE_API_BASE_URL);
}
}
export class NScaleCloudTextGenerationTask extends BaseTextGenerationTask {
constructor() {
super("nscale-cloud", NSCALE_API_BASE_URL);
}
override makeRoute(): string {
return "v1/chat/completions";
}
}
export class NScaleCloudTextToImageTask extends TaskProviderHelper implements TextToImageTaskHelper {
constructor() {
super("nscale-cloud", NSCALE_API_BASE_URL);
}
makeRoute(): string {
return "v1/images/generations";
}
preparePayload(params: BodyParams): Record<string, unknown> {
// refer to Nebius implementation of preparePayload
}
getResponse(
response: unknown,
url?: string,
headers?: HeadersInit,
outputType?: "url" | "blob"
): Promise<string | Blob>{
// Refer to Nebius implementation of getResponse
}
} You can check Nebius implementation of text-to-image, it looks like it's the same payload and response format as NScale-cloud. |
Hey @hanouticelina, |
it's better if they're the same, do you want us to check if we can move your org to |
yes that would be great, thanks! |
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.
Hi there - thank you for your conribution!
I have two minor comments - otherwise the PR looks good !
Ping @hanouticelina for a quick validation before merging
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
looks good, thank you @nbarr07!
@hanouticelina @SBrandeis thank you for the review and changes! |
Co-authored-by: Simon Brandeis <[email protected]>
Hey @hanouticelina @SBrandeis , just to get an idea, when could we expect to merge the PR? |
let's merge this, thank you @nbarr07 again for the contribution! |
Integrate Nscale provider for HuggingFace Inference
This PR adds support for Nscale inference to the HuggingFace inference API.
Note that our inference service is not publicly live yet but will be soon - this draft PR is for review and preparation.
The tests were all passing when I tried. Any feedback are welcomed!