Skip to content

Conversation

@suryabdev
Copy link
Contributor

Recently retries for RPM errors was added #1801. This is a follow up enhancement that adds exponential backoff with jitter

It is a best practise as explained in the Open AI Cookbook
https://cookbook.openai.com/examples/how_to_handle_rate_limits#example-3-manual-backoff-implementation

@suryabdev
Copy link
Contributor Author

cc: @albertvillanova / @aymeric-roucher please review when you are free

Copy link
Collaborator

@aymeric-roucher aymeric-roucher left a comment

Choose a reason for hiding this comment

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

Thank you, good improvements!

@suryabdev
Copy link
Contributor Author

Thanks for the review @aymeric-roucher
Quality check failed. I've pushed a commit with the style changes
Please re-trigger the checks when you are free

@suryabdev
Copy link
Contributor Author

suryabdev commented Oct 27, 2025

The test are failing with a error from tokenizers on 3.12, Interestingly it passes on 3.10

error: casting `&T` to `&mut T` is undefined behavior, even if the
      reference is unused, consider instead using an `UnsafeCell`
         --> tokenizers-lib/src/models/bpe/trainer.rs:517:47
          |
      513 |                     let w = &words[*i] as *const _ as *mut _;
          |                             --------------------------------
      casting happened here
      ...
      517 |                         let word: &mut Word = &mut (*w);
          |                                               ^^^^^^^^^
          |
          = note: for more information, visit
      <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
          = note: `#[deny(invalid_reference_casting)]` on by default

Found a transformers thread with the same error huggingface/transformers#29576

There are some comments saying that it was a 3.12 problem and 3.10 worked. Adding some Rust flags fixed it for them
In newer versions of transformers the issue isn't seen

And interestingly the 3.10 build used

transformers==4.57.1
tokenizers==0.22.1

While the 3.12 build used

transformers v4.12.2
tokenizers==0.10.3

So I think it is a problem with the transformers/tokenizers version that got used

@aymeric-roucher
Copy link
Collaborator

Indeed that bug is not related to the current PR: lgtm!

@aymeric-roucher aymeric-roucher merged commit ff06a0c into huggingface:main Oct 28, 2025
2 of 3 checks passed
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.

2 participants