khanrc / honeybee

Official implementation of project Honeybee (CVPR 2024)
Other
428 stars 19 forks source link

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' #11

Closed fengmingfeng closed 9 months ago

fengmingfeng commented 9 months ago

when i run the inference_example.ipynb, such as: %matplotlib inline

from PIL import Image import matplotlib.pyplot as plt import torch from pipeline.interface import get_model

it occur some problem:

TypeError Traceback (most recent call last) Cell In[2], line 8 4 import matplotlib.pyplot as plt 6 import torch ----> 8 from pipeline.interface import get_model

File ~/autodl-tmp/honeybee/pipeline/interface.py:10 7 from transformers.utils.constants import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD 8 from pathlib import Path ---> 10 from honeybee.modeling_honeybee import HoneybeeForConditionalGeneration 11 from honeybee.processing_honeybee import HoneybeeImageProcessor, HoneybeeProcessor 14 def load_model(pretrained_ckpt, use_bf16=True, load_in_8bit=False):

File ~/autodl-tmp/honeybee/honeybee/init.py:1 ----> 1 from .configuration_honeybee import 2 from .modeling_honeybee import 3 from .processing_honeybee import *

File ~/autodl-tmp/honeybee/honeybee/configuration_honeybee.py:116 108 logger.warning( 109 f"You are using a model of type {config_dict['model_type']} to instantiate a model of type " 110 f"{cls.model_type}. This is not supported for all configurations of models and can yield errors." 111 ) 113 return cls.from_dict(config_dict, **kwargs) --> 116 class HoneybeeConfig(PretrainedConfig): 117 model_type = "mllm" 118 is_composition = True

File ~/autodl-tmp/honeybee/honeybee/configuration_honeybee.py:122, in HoneybeeConfig() 117 model_type = "mllm" 118 is_composition = True 120 def init( 121 self, --> 122 vision_config: dict | None = None, 123 visual_projector_config: dict | None = None, 124 num_query_tokens: int = 64, 125 lm_config: dict | None = None, 126 kwargs, 127 ): 128 super().init(kwargs) 129 pretrained_vision_name_or_path = vision_config.get("pretrained_vision_name_or_path")

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

wykang commented 9 months ago

What version of Python are you using?

The "TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'" error that you mentioned could be due to a difference in the Python version being used. To use type aliases with '|', you should use Python 3.10 or higher (https://peps.python.org/pep-0604/).

fengmingfeng commented 9 months ago

What version of Python are you using?

The "TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'" error that you mentioned could be due to a difference in the Python version being used. To use type aliases with '|', you should use Python 3.10 or higher (https://peps.python.org/pep-0604/).

we use python 3.8

wykang commented 9 months ago

Can you try again after upgrading your Python version to 3.10 or higher?

fengmingfeng commented 9 months ago

What version of Python are you using?

The "TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'" error that you mentioned could be due to a difference in the Python version being used. To use type aliases with '|', you should use Python 3.10 or higher (https://peps.python.org/pep-0604/).

thank you,when i update python to 3.10 have solved this problem.