Skip to content

Conversation

mattt
Copy link
Collaborator

@mattt mattt commented Sep 28, 2025

Resolves #271

@mattt mattt force-pushed the mattt/top-p branch 2 times, most recently from f9b6ac3 to 81c9d53 Compare September 28, 2025 14:19
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": false,
"DontRepeatTypeInStaticProperties": true,
"DontRepeatTypeInStaticProperties": false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Strange that the lint check fails even when this is disabled. FWIW, I also can't reproduce the lint failure locally...

Sources/Models/LanguageModel.swift:132:20: warning: [DontRepeatTypeInStaticProperties] remove the suffix 'Keys' from the name of the variable 'presentKeys'

static let valueCache = "valueCache"
// Output keys
static let logits = "logits"
// swift-format-ignore: DontRepeatTypeInStaticProperties
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lint check failing despite disabling rule globally in .swift-format and using this swift-format-ignore: directive...

@mattt mattt requested a review from pcuenca September 28, 2025 14:29
@kashif
Copy link
Contributor

kashif commented Sep 28, 2025

@mattt feel free to use any insights from my PR #273

@mattt
Copy link
Collaborator Author

mattt commented Sep 28, 2025

@kashif Ha! I just saw your PR opened at the same time and was about to comment the same 😃

I haven't dug in too much, but on first glance, I think #273 has a better top-p and repetition penalty implementations that make better use of MLTensor functionality. I'll close mine for now so we can focus on yours instead. Thanks for your contribution!

@mattt mattt closed this Sep 28, 2025
@kashif
Copy link
Contributor

kashif commented Sep 28, 2025

@mattt no worries! I am test via:

swift run --package-path ../transformers-cli transformers-cli  --do-sample true --top-k 20 --top-p 0.9 --temperature 0.7 --repetition-penalty 1.5     \
  "Best recommendations for a place to visit in Paris in August 2024:" \
  --max-length 356 StatefulMistral7BInstructInt4.mlpackage

so you can also try that out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add back Top-P sampling, Repetition Penalty, Logits Warpers
2 participants