Error loading pretrained model: Error parsing message

#13
by IamRifat - opened

Hi everyone,
I am trying to execute the below script.

#import libraries
import textwrap
import glob2
from io import BytesIO
import requests
import torch
from llava.constants import DEFAULT_IMAGE_TOKEN, IMAGE_TOKEN_INDEX
from llava.conversation import SeparatorStyle, conv_templates
from llava.mm_utils import (
KeywordsStoppingCriteria,
get_model_name_from_path,
process_images,
tokenizer_image_token
)
from llava.model.builder import load_pretrained_model
from llava.utils import disable_torch_init
from PIL import Image
import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import sys
from termcolor import colored, cprint

#pretrained model path and 4 bit quantized model of LLava
MODEL='llava-v1.5-13b'
model_name = get_model_name_from_path(MODEL)

print(f"Model Name: {model_name}")
print(os.listdir(MODEL))

#import the images from a picture directory

#path to thte pictures directory
path = 'Pictures/*.jpg'

#List to store images and their correponding file names
images = []
filenames = []

#read each images
for filename in glob2.glob(path):
img = Image.open(filename)
images.append(img)
filenames.append(filename)

print(colored('I am about to load the Pre-trained model.', 'red', attrs=['reverse', 'blink']))

Import the tokenizer and the pretrained model for Llava

try:
tokenizer,model,image_processor,context_len=load_pretrained_model(
model_path=MODEL,model_base=None,model_name=model_name,load_4bit=True
)
except Exception as e:
print(f"Error loading pretrained model: {e}")
raise

However, my script is showing the below error. I don't have any idea why it is giving me this error. Please help me with this issue.
image.png

Sign up or log in to comment