Skip to content

Exception: data did not match any variant of untagged enum ModelWrappe #52

@HoangLayor

Description

@HoangLayor

Can you provide me with the versions of torch, transformers, tokenizers, and accelerate?
I guess I'm having an issue with my installation environment.

# pip install accelerate
import requests
from PIL import Image
from transformers import Blip2Processor, Blip2ForConditionalGeneration

processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b", cache_dir="/tmp")
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", device_map="auto")
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[1], line 6
      4 from transformers import Blip2Processor, Blip2ForConditionalGeneration
----> 6 processor = Blip2Processor.from_pretrained("Salesforce/blip2-opt-2.7b", cache_dir="/tmp")
      7 model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", device_map="auto")

in ProcessorMixin.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, **kwargs)
    225 if token is not None:
    226     kwargs["token"] = token
--> 228 args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
    229 return cls(*args)

 in ProcessorMixin._get_arguments_from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    269     else:
    270         attribute_class = getattr(transformers_module, class_name)
--> 272     args.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))
    273 return args

 in AutoTokenizer.from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
    783     if tokenizer_class is None:
    784         raise ValueError(
    785             f"Tokenizer class {tokenizer_class_candidate} does not exist or is not currently imported."
    786         )
--> 787     return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
    789 # Otherwise we have to be creative.
    790 # if model is an encoder decoder, the encoder tokenizer class is used by default
    791 if isinstance(config, EncoderDecoderConfig):

in PreTrainedTokenizerBase.from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, *init_inputs, **kwargs)

-> 2028 return cls._from_pretrained(
   2029     resolved_vocab_files,
   2030     pretrained_model_name_or_path,
   2031     init_configuration,
   2032     *init_inputs,
   2033     token=token,
   2034     cache_dir=cache_dir,
   2035     local_files_only=local_files_only,
   2036     _commit_hash=commit_hash,
   2037     _is_local=is_local,
   2038     **kwargs,
   2039 )

in PreTrainedTokenizerBase._from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, token, cache_dir, local_files_only, _commit_hash, _is_local, *init_inputs, **kwargs)
   2258 # Instantiate the tokenizer.
   2259 try:
-> 2260     tokenizer = cls(*init_inputs, **init_kwargs)

in GPT2TokenizerFast.__init__(self, vocab_file, merges_file, tokenizer_file, unk_token, bos_token, eos_token, add_prefix_space, **kwargs)
  
--> 134     super().__init__(
    135         vocab_file,
    136         merges_file,
    137         tokenizer_file=tokenizer_file,
    138         unk_token=unk_token,
    139         bos_token=bos_token,
    140         eos_token=eos_token,
    141         add_prefix_space=add_prefix_space,
    142         **kwargs,
    143     )

in PreTrainedTokenizerFast.__init__(self, *args, **kwargs)
    108     fast_tokenizer = copy.deepcopy(tokenizer_object)
    109 elif fast_tokenizer_file is not None and not from_slow:
    110     # We have a serialization from tokenizers which let us directly build the backend
--> 111     fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
    112 elif slow_tokenizer is not None:
    113     # We need to convert a slow tokenizer to build the backend
    114     fast_tokenizer = convert_slow_tokenizer(slow_tokenizer)

Exception: data did not match any variant of untagged enum ModelWrapper at line 250373 column 3

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions