Skip to content
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

.Net: Use state for the tokenizer/encoding for all examples with a tokencount #5519

Merged
merged 2 commits into from
Mar 19, 2024

Conversation

tonybaloney
Copy link
Contributor

Fixes #5515

Motivation and Context

The examples for the text splitter all instantiate the encoder/tokenizer every-time the count function is called. This updates the samples to have a count method against a class that stores the encoding.

Description

Contribution Checklist

…nter callback for improved performance and reduced memory usage
@tonybaloney tonybaloney requested a review from a team as a code owner March 18, 2024 05:19
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Mar 18, 2024
@github-actions github-actions bot changed the title Use state for the tokenizer/encoding for all examples with a tokencount .Net: Use state for the tokenizer/encoding for all examples with a tokencount Mar 18, 2024
@markwallace-microsoft markwallace-microsoft self-assigned this Mar 19, 2024
@RogerBarreto RogerBarreto added this pull request to the merge queue Mar 19, 2024
Merged via the queue into microsoft:main with commit 561a9be Mar 19, 2024
18 checks passed
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
…kencount (microsoft#5519)

Fixes microsoft#5515 

### Motivation and Context

The examples for the text splitter all instantiate the encoder/tokenizer
*every*-time the count function is called. This updates the samples to
have a count method against a class that stores the encoding.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

Co-authored-by: Roger Barreto <19890735+RogerBarreto@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.NET Issue or Pull requests regarding .NET code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

.Net: Examples encourage stateless token counter functions
3 participants