Skip to content

Tokenizer.Decode special-cases EnglishRoberta #7010

Closed
@stephentoub

Description

@stephentoub

This suggests there's something wrong with the Model abstraction, and it means that any other model of a similar ilk to EnglishRoberta could not be supported (or not supported efficiently, or whatever reason caused this to be special-cased here). The special-casing should be removed and the abstraction fixed to make the special-casing unnecessary.

if (Model is EnglishRoberta robertaModel)
{
foreach (int id in ids)
{
tokens.Add(robertaModel.IdToFilteredToken(id, skipSpecialTokens) ?? "");
}
}
else
{
foreach (int id in ids)
{
tokens.Add(Model.IdToToken(id, skipSpecialTokens) ?? "");
}
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions