From 74f4a5fff4f3daf8d5f3db85dadf11f38a9fdfb7 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 19 Aug 2025 23:43:58 -0700 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index fd4cd81d83..85f1a9a960 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -273,6 +273,18 @@ try: except: pass +# UserWarning: Logical operators 'and' and 'or' are deprecated for non-scalar tensors; please use '&' or '|' instead +# Will be fixed in torch 2.8.1 https://github.com/pytorch/pytorch/issues/158463 +try: + warnings.filterwarnings( + action = "ignore", + message = r".*Logical operators 'and' and 'or'.*", + category = UserWarning, + append = True, + ) +except: + pass + # Using a slow image processor as `use_fast` try: from transformers.processing_utils import logger as processing_utils_logger