Handle transformers move to dtype from torch_dtype #3225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The latest transformers is now using dtype instead of torch_dtype throughout. This PR handles this move as well as keep it BC for older transformer versions. Depends on unslothai/unsloth-zoo#255
Notebooks tested for training:
qwen3 sft: https://colab.research.google.com/drive/1a3GQf6fgiw8LvkcqUtjawweG-XNZoXsL?usp=sharing
llama 3.2: https://colab.research.google.com/drive/1xmHA144D_7BrXrsOYa4KRNf6Px0PDS_L?usp=sharing
gpt-oss: https://colab.research.google.com/drive/1ZonfSgVbuDBu8ZsbdUYQ1qpC4y5J5KlF?usp=sharing
gemma3n vision: https://colab.research.google.com/drive/1q_oXN7vARKPnV_Tgfn3CFhqIZvfsMa83?usp=sharing
grpo qwen3: https://colab.research.google.com/drive/1B247FF6xQSZhDYCitX90Eytsj2JSBz8X?usp=sharing
qwen 2.5vl: https://colab.research.google.com/drive/1xiGzQONx5J9cKbym-PEcsYY3b61jbjEA?usp=sharing
gemma3 270: https://colab.research.google.com/drive/1lCcO_5Ty32NtTRopZ2mSSk48_BC_YRJf?usp=sharing
orpheus: https://colab.research.google.com/drive/1aaqKA9CFkbkIh6-yFR7fO5mKcf8nVG9A?usp=sharing
grpo deepseek: https://colab.research.google.com/drive/1zbG-CXXT186V_o1cbK--g-f3zJakRwjF?usp=sharing