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

Add nvtext::tokenized_to_tensor API #17932

Draft
wants to merge 2 commits into
base: branch-25.04
Choose a base branch
from

Conversation

davidwendt
Copy link
Contributor

Description

Adds new nvtest::tokenized_to_tensor API for compatibility of the existing subword tokenizer. The tokenizer is to be replaced with a normalizer, wordpiece tokenizer and this new API to provide the complete functions to match what the subword tokenizer currently produces.

The wordpiece tokenizer created here #17600 will produce tokens for an input strings column as a list column of integers. This list column can be provided to this new API to produce the existing tensor data structure containing token-ids truncated or strided as well as an attention mask and metadata.

nvtext::tokenizer_result nvtext::tokenized_to_tensor(
  cudf::lists_column_view const& input,
  cudf::size_type max_sequence_length,
  cudf::size_type stride,
  bool do_truncate,
  rmm::cuda_stream_view stream ,
  rmm::device_async_resource_ref mr);

The nvtext::tokenizer_result is defined here:

struct tokenizer_result {

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt added 2 - In Progress Currently a work in progress libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Feb 6, 2025
@davidwendt davidwendt self-assigned this Feb 6, 2025
Copy link

copy-pr-bot bot commented Feb 6, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@davidwendt
Copy link
Contributor Author

/ok to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In Progress Currently a work in progress improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant