-
Notifications
You must be signed in to change notification settings - Fork 530
[Inference] Update snippets #1129
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
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.
i would maybe add one example of how a third-party provider can define their own snippet for one particular task
cc @julien-c Goal is to easily review inference snippets changes by generating and committing the expected snippets that will be shown on the Hub. For now mostly adapter for `"hf-inference"` provider + added 1 example with `"replicate"`. In practice, we can add more examples once merged to #1129 **How to use:** 1. Go to `@tasks-gen` 2. Edit `packages/tasks-gen/scripts/generate-snippets-fixtures.ts` to add new examples 3. Run ``` pnpm run generate-snippets-fixtures ``` 4. Use git diff to check difference => commit them Afterwards, run tests (also done in CI) ``` pnpm test ``` **Note:** I haven't properly checked the snippets themselves. Will do it once merged when reviewing #1129. --------- Co-authored-by: Julien Chaumond <[email protected]>
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. |
content: `async function query(data) { | ||
const client = new HfInference("${accessToken || `{API_TOKEN}`}"); | ||
const image = await client.textToImage({ |
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.
root-level await
statements are not supported by all the usual JS runtimes
provider: InferenceProvider | ||
): InferenceSnippet[] => { | ||
return [ | ||
{ |
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.
Should we keep this?
If yes, let's add install instructions to other snippets
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.
this = snippet.setup
installation instructions
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.
(removed it)
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.
yes fine to remove imo
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.
👍 (only checked Python snippets)
No description provided.