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: Bug:Microsoft.SemanticKernel.Connectors.Onnx private async IAsyncEnumerable<string> RunInferenceAsyncthe Chinese is not garbled #10209

Open
yuydev opened this issue Jan 16, 2025 · 0 comments
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@yuydev
Copy link

yuydev commented Jan 16, 2025

Describe the bug
Microsoft.SemanticKernel.Connectors.Onnx private async IAsyncEnumerable RunInferenceAsync(ChatHistory chatHistory, PromptExecutionSettings? executionSettings, [EnumeratorCancellation] CancellationToken cancellationToken) the Chinese is not garbled

generator.ComputeLogits();
generator.GenerateNextToken();

var outputTokens = generator.GetSequence(0);
var newToken = outputTokens.Slice(outputTokens.Length - 1, 1);
string output = this.GetTokenizer().Decode(newToken);

if (removeNextTokenStartingWithSpace && output[0] == ' ')
{
removeNextTokenStartingWithSpace = false;
output = output.TrimStart();
}

/** After the modification, the Chinese is not garbled
generator.ComputeLogits();
generator.GenerateNextToken();

var outputTokens = generator.GetSequence(0);
var seq = outputTokens[^1];

var _tokenizer = GetTokenizer();
using var tokenizerStream = _tokenizer.CreateStream();
string output = tokenizerStream.Decode(seq);
return output; */

Platform

  • OS: [Windows,]
  • IDE: [Visual Studio]
  • Language: [C#, ]
  • Source: [e.g. NuGet package version 0.1.0, pip package version 0.1.0, main branch of repository]

Additional context
Add any other context about the problem here.

@yuydev yuydev added the bug Something isn't working label Jan 16, 2025
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Jan 16, 2025
@github-actions github-actions bot changed the title Bug:Microsoft.SemanticKernel.Connectors.Onnx private async IAsyncEnumerable<string> RunInferenceAsyncthe Chinese is not garbled .Net: Bug:Microsoft.SemanticKernel.Connectors.Onnx private async IAsyncEnumerable<string> RunInferenceAsyncthe Chinese is not garbled Jan 16, 2025
@RogerBarreto RogerBarreto moved this from Bug to Sprint: In Progress in Semantic Kernel Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: In Progress
Development

No branches or pull requests

3 participants