Skip to content

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType #5

Description

@ppdk-data

Cell In[12], line 7
5 version = "zh-clip-vit-roberta-large-patch14"
6 model = ZhCLIPModel.from_pretrained(version)
----> 7 processor = ZhCLIPProcessor.from_pretrained(version)

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/transformers/processing_utils.py:184, in ProcessorMixin.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
153 @classmethod
154 def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
155 r"""
156 Instantiate a processor associated with a pretrained model.
157
(...)
182 [~tokenization_utils_base.PreTrainedTokenizer.from_pretrained].
183 """
--> 184 args = cls._get_arguments_from_pretrained(pretrained_model_name_or_path, **kwargs)
185 return cls(*args)

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/transformers/processing_utils.py:228, in ProcessorMixin._get_arguments_from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
225 else:
226 attribute_class = getattr(transformers_module, class_name)
--> 228 args.append(attribute_class.from_pretrained(pretrained_model_name_or_path, **kwargs))
229 return args

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/transformers/tokenization_utils_base.py:1804, in PreTrainedTokenizerBase.from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
1801 else:
1802 logger.info(f"loading file {file_path} from cache at {resolved_vocab_files[file_id]}")
-> 1804 return cls._from_pretrained(
1805 resolved_vocab_files,
1806 pretrained_model_name_or_path,
1807 init_configuration,
1808 *init_inputs,
1809 use_auth_token=use_auth_token,
1810 cache_dir=cache_dir,
1811 local_files_only=local_files_only,
1812 _commit_hash=commit_hash,
1813 **kwargs,
1814 )

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/transformers/tokenization_utils_base.py:1958, in PreTrainedTokenizerBase._from_pretrained(cls, resolved_vocab_files, pretrained_model_name_or_path, init_configuration, use_auth_token, cache_dir, local_files_only, _commit_hash, *init_inputs, **kwargs)
1956 # Instantiate tokenizer.
1957 try:
-> 1958 tokenizer = cls(*init_inputs, **init_kwargs)
1959 except OSError:
1960 raise OSError(
1961 "Unable to load vocabulary from file. "
1962 "Please check that the provided vocabulary is accessible and not corrupted."
1963 )

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/transformers/models/bert/tokenization_bert.py:213, in BertTokenizer.init(self, vocab_file, do_lower_case, do_basic_tokenize, never_split, unk_token, sep_token, pad_token, cls_token, mask_token, tokenize_chinese_chars, strip_accents, **kwargs)
184 def init(
185 self,
186 vocab_file,
(...)
197 **kwargs,
198 ):
199 super().init(
200 do_lower_case=do_lower_case,
201 do_basic_tokenize=do_basic_tokenize,
(...)
210 **kwargs,
211 )
--> 213 if not os.path.isfile(vocab_file):
214 raise ValueError(
215 f"Can't find a vocabulary file at path '{vocab_file}'. To load the vocabulary from a Google pretrained"
216 " model use tokenizer = BertTokenizer.from_pretrained(PRETRAINED_MODEL_NAME)"
217 )
218 self.vocab = load_vocab(vocab_file)

File ~/.conda/envs/diffuser_python/lib/python3.9/genericpath.py:30, in isfile(path)
28 """Test whether a path is a regular file"""
29 try:
---> 30 st = os.stat(path)
31 except (OSError, ValueError):
32 return False

实例化processor的时候报这个错是为啥

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