Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add snippets tests & response_format support#1524

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
TGlide wants to merge2 commits intohuggingface:main
base:main
Choose a base branch
Loading
fromTGlide:structured-snippets

Conversation

TGlide
Copy link
Member

No description provided.

@Wauplin
Copy link
Contributor

Hey@TGlide let me know if you want any guidance about inference snippets or a review :)

@TGlide
Copy link
MemberAuthor

Hi@Wauplin sorry for the delay! Yes, I would love a review, specially to see if I've gone about this the right way.

Copy link
Contributor

@WauplinWauplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hey@TGlide , understood! I've had a first look at it, let me know if you have extra questions :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

sorry about all the work done on this module but tests are actually defined in thetasks-gen package (see./tasks-gen/scripts/generate-snippets-fixtures.ts) and fixtures are auto-generated + committed in./packages/tasks-gen/snippets-fixtures. This way we can easily spot in a PR what has changed and if the snippets are looking good.

@@ -3,6 +3,9 @@
*
* Using src/scripts/inference-codegen
*/

import type { ChatCompletionInputGrammarType } from "../chat-completion/inference.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this is not needed in ASR types I believe

temperature?: GenerationParameters["temperature"];
max_tokens?: GenerationParameters["max_new_tokens"];
top_p?: GenerationParameters["top_p"];
response_format?: Record<string, unknown>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think there is a confusion between the Chat Completion API that accepts aresponse_format and the Text Generation API that accepts agrammar input.

@@ -408,6 +436,46 @@ function formatBody(obj: object, format: "curl" | "json" | "python" | "ts"): str
}
}

function formatPythonValue(obj: unknown, depth?: number): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I start to really think we should first generate the snippets and then format it. Seems that there are a few solutions although not very popular (blackjs,prettier/plugin-python). For now, let's keep it like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Out of curiosity, was this code auto-generate or written manually? (if yes, better to mention it in docstring)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(note to myself, maybe a single-file python formatter would be enough given our small requirements.Here's an example)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@WauplinWauplinWauplin left review comments

@SBrandeisSBrandeisAwaiting requested review from SBrandeisSBrandeis will be requested when the pull request is marked ready for reviewSBrandeis is a code owner

@gary149gary149Awaiting requested review from gary149gary149 will be requested when the pull request is marked ready for reviewgary149 is a code owner

@julien-cjulien-cAwaiting requested review from julien-cjulien-c will be requested when the pull request is marked ready for reviewjulien-c is a code owner

@pcuencapcuencaAwaiting requested review from pcuencapcuenca will be requested when the pull request is marked ready for reviewpcuenca is a code owner

@ngxsonngxsonAwaiting requested review from ngxsonngxson will be requested when the pull request is marked ready for reviewngxson is a code owner

@hanouticelinahanouticelinaAwaiting requested review from hanouticelinahanouticelina will be requested when the pull request is marked ready for reviewhanouticelina is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@TGlide@Wauplin

[8]ページ先頭

©2009-2025 Movatter.jp