Repository navigation
Description
started getting this error with unsloth vision models:
AttributeError Traceback (most recent call last)
Cell In[1], line 22
4 # 4bit pre quantized models we support for 4x faster downloading + no OOMs.
5 fourbit_models = [
6 "unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit", # Llama 3.2 vision support
7 "unsloth/Llama-3.2-11B-Vision-bnb-4bit",
(...)
19 "unsloth/llava-1.5-7b-hf-bnb-4bit",
20 ] # More models at https://huggingface.co/unsloth
---> 22 model, tokenizer = FastVisionModel.from_pretrained(
23 "unsloth/Qwen2-VL-2B-Instruct-bnb-4bit",
24 load_in_4bit = True, # Use 4bit to reduce memory use. False for 16bit LoRA.
25 use_gradient_checkpointing = "unsloth", # True or "unsloth" for long context
26 )
File ~/Documents/sci_papers/25_innovation_index/venv/lib/python3.11/site-packages/unsloth/models/loader.py:354, in FastVisionModel.from_pretrained(model_name, max_seq_length, dtype, load_in_4bit, token, device_map, rope_scaling, fix_tokenizer, trust_remote_code, use_gradient_checkpointing, resize_model_vocab, revision, *args, **kwargs)
336 @staticmethod
337 def from_pretrained(
338 model_name = "unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit",
(...)
350 *args, **kwargs,
351 ):
352 if token is None: token = get_token()
--> 354 patch_compiled_autograd()
355 patch_compiling_bitsandbytes()
356 if use_gradient_checkpointing == "unsloth":
File ~/Documents/sci_papers/25_innovation_index/venv/lib/python3.11/site-packages/unsloth_zoo/patching_utils.py:320, in patch_compiled_autograd()
318 source = "\n".join(x[spaces:] for x in source)
319 old = "return compiled_fn(inputs, sizes, scalars, hooks)"
--> 320 n = len(re.search(r"\n([ ]{1,})return compiled_fn", source).group(1))
321 source = source.replace(old, f"with disable():\n{' '*(n + 4)}{old}")
322 source = source.replace("def end_capture", "def unsloth_end_capture", 1)
AttributeError: 'NoneType' object has no attribute 'group'
versions:
unsloth 2024.11.9
unsloth_zoo 2024.11.7
torch 2.3.1
Activity
angry-ai commentedon Nov 24, 2024
I see that vision models only works with torch 2.4.0
chenwenxinqaq commentedon Jan 7, 2025
could you pls tell me how to solve this probelm? i have the same problem