diff --git a/pyproject.toml b/pyproject.toml index fb63f89ae6..1d46c8824b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ huggingfacenotorch = [ ] huggingface = [ "unsloth[huggingfacenotorch]", - "unsloth_zoo>=2025.10.6", + "unsloth_zoo>=2025.10.8", "torchvision", "unsloth[triton]", ] @@ -461,7 +461,7 @@ colab-ampere-torch220 = [ "flash-attn>=2.6.3 ; ('linux' in sys_platform)", ] colab-new = [ - "unsloth_zoo>=2025.10.6", + "unsloth_zoo>=2025.10.8", "packaging", "tyro", "transformers>=4.51.3,!=4.52.0,!=4.52.1,!=4.52.2,!=4.52.3,!=4.53.0,!=4.54.0,!=4.55.0,!=4.55.1,<=4.56.2", diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 78ca68b449..22ce2fd9e5 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.10.6" +__version__ = "2025.10.7" __all__ = [ "SUPPORTS_BFLOAT16", @@ -163,7 +163,6 @@ warnings.filterwarnings(action = "ignore", category = RuntimeWarning, module = "multiprocessing") warnings.filterwarnings(action = "ignore", category = RuntimeWarning, module = "multiprocess") warnings.filterwarnings(action = "ignore", category = UserWarning, module = "triton") - # Stop "Special tokens have been added in the vocabulary, ..." import logging logging.getLogger("transformers.tokenization_utils_base").setLevel(logging.CRITICAL+1) @@ -215,6 +214,12 @@ def filter(self, x): return not (self.text in x.getMessage()) del vllm_lora_model_logger except: pass + try: + from vllm.attention.utils.fa_utils import logger as vllm_attention_utils_fa_utils_logger + vllm_attention_utils_fa_utils_logger.addFilter(HideLoggingMessage("Cannot use FA version")) + del vllm_attention_utils_fa_utils_logger + except: + pass pass # The speedups for torchdynamo mostly come with GPU Ampere or higher and which is not detected here. @@ -344,6 +349,14 @@ def filter(self, x): return not (self.text in x.getMessage()) except: pass +# We detected that you are using `from_pretrained` with a meta device context manager or `torch.set_default_device('meta') +try: + from transformers.modeling_utils import logger as modeling_utils_logger + modeling_utils_logger.addFilter(HideLoggingMessage("anti-pattern")) + del modeling_utils_logger +except: + pass + # Errors out on # Some weights of Gemma3nForConditionalGeneration were not initialized from the model checkpoint from transformers.modeling_utils import logger as transformers_logger diff --git a/unsloth/tokenizer_utils.py b/unsloth/tokenizer_utils.py index 067f2596c6..b35c1326ca 100644 --- a/unsloth/tokenizer_utils.py +++ b/unsloth/tokenizer_utils.py @@ -345,7 +345,23 @@ def fix_sentencepiece_tokenizer( ): # From https://github.com/google/sentencepiece/issues/121 # We need to manually edit the sentencepiece tokenizer! - from transformers.utils import sentencepiece_model_pb2 + try: + from transformers.convert_slow_tokenizer import import_protobuf + sentencepiece_model_pb2 = import_protobuf() + except Exception as e: + try: + import google.protobuf + from unsloth_zoo.utils import Version + protobuf_version = Version(google.protobuf.__version__) + if protobuf_version > Version("3.20.3"): + raise RuntimeError( + f"Unsloth: Your protobuf version = {protobuf_version} is too new.\n"\ + f"Please downgrade via `pip install --force-reinstall protobuf==3.20.3`" + ) + except: + # This will only work for older SentencePiece versions <= 3.20.3 + from transformers.utils import sentencepiece_model_pb2 + pass if not os.path.exists(temporary_location): os.makedirs(temporary_location)