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

HF tokenizer_call_args #793

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

HF tokenizer_call_args #793

wants to merge 1 commit into from

Conversation

alexandrasouly-aisi
Copy link

This PR contains:

  • [x ] New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

I am trying to add strongreject to inspect evals, and some parts use a HF model with a small context length, so they use the tokeniser to truncate the input. I would like the tokenizer call to be more flexible take custom arguments.

What is the current behavior? (You can also link to an open issue here)

HF tokenizer is called with default parameters tokenizer(response, max_length=max_response_length, truncation=True)

What is the new behavior?

The API would take a tokenizer_call_args dict to be passed onto the tokenizer call.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No

Other information:

@@ -71,6 +71,9 @@ def collect_model_arg(name: str) -> Any | None:
tokenizer_path = collect_model_arg("tokenizer_path")
self.batch_size = collect_model_arg("batch_size")
self.chat_template = collect_model_arg("chat_template")
self.tokenizer_call_args = collect_model_arg("tokenizer_call_args")
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about just tokenizer_args?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@alexandrasouly-aisi Are you okay w/ the change to tokenizer_args?

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.

3 participants