8000 'BertTokenizer' object has no attribute 'vocab' · Issue #11 · Zoky-2020/SGA · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
'BertTokenizer' object has no attribute 'vocab' #11
Open
@chenwutao123

Description

@chenwutao123

E:\program_tools\envs\py38\python.exe "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\eval_albef2clip-vit_flickr.py" --config ./configs/Retrieval_flickr.yaml --source_model ALBEF --source_ckpt ./checkpoint/albef_retrieval_flickr.pth --target_model ViT-B/16 --original_rank_index ./std_eval_idx/flickr30k/ --scales 0.5,0.75,1.25,1.5
E:\program_tools\envs\py38\lib\site-packages\timm\models\registry.py:4: FutureWarning: Importing from timm.models.registry is deprecated, please import via timm.models
warnings.warn(f"Importing from {name} is deprecated, please import via timm.models", FutureWarning)
E:\program_tools\envs\py38\lib\site-packages\timm\models\layers_init_.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {name} is deprecated, please import via timm.layers", FutureWarning)
Creating Source Model
Traceback (most recent call last):
File "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\eval_albef2clip-vit_flickr.py", line 358, in
main(args, config)
File "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\eval_albef2clip-vit_flickr.py", line 306, in main
model, ref_model, tokenizer = load_model(args.source_model, args.source_ckpt, args.source_text_encoder, device)
File "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\eval_albef2clip-vit_flickr.py", line 232, in load_model
tokenizer = BertTokenizer.from_pretrained(text_encoder)
File "E:\program_tools\envs\py38\lib\site-packages\transformers\tokenization_utils_base.py", line 2213, in from_pretrained
return cls._from_pretrained(
File "E:\program_tools\envs\py38\lib\site-packages\transformers\tokenization_utils_base.py", line 2447, in _from_pretrained
tokenizer = cls(*init_inputs, **init_kwargs)
File "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\models\tokenization_bert.py", line 176, in init
super().init(
File "E:\program_tools\envs\py38\lib\site-packages\transformers\tokenization_utils.py", line 439, in init
self._add_tokens(
File "E:\program_tools\envs\py38\lib\site-packages\transformers\tokenization_utils.py", line 547, in _add_tokens
current_vocab = self.get_vocab().copy()
File "F:\对抗攻击\VLP\SGA-main (2)\SGA-main\models\tokenization_bert.py", line 216, in get_vocab
return dict(self.vocab, **self.added_tokens_encoder)
AttributeError: 'BertTokenizer' object has no attribute 'vocab'

Process finished with exit code 1
很抱歉我一直无法解决这个问题,请教一下

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0