mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
[Llava
] Fix convert_llava_weights_to_hf.py script (#28570)
* Update convert_llava_weights_to_hf.py Fix call to `tokenizer.add_tokens` * Add special_tokens to tokenizer.add_tokens in convert_vipllava_weights_to_hf.py
This commit is contained in:
parent
faf03541e2
commit
5b7f4bc6c1
@ -55,7 +55,7 @@ def convert_llava_llama_to_hf(text_model_id, vision_model_id, output_hub_path, o
|
|||||||
text_config = AutoConfig.from_pretrained(text_model_id)
|
text_config = AutoConfig.from_pretrained(text_model_id)
|
||||||
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained(text_model_id)
|
tokenizer = AutoTokenizer.from_pretrained(text_model_id)
|
||||||
tokenizer.add_tokens(AddedToken("<image>", special=True, normalized=False), special=True)
|
tokenizer.add_tokens(AddedToken("<image>", special=True, normalized=False), special_tokens=True)
|
||||||
tokenizer.add_special_tokens({"pad_token": "<pad>"})
|
tokenizer.add_special_tokens({"pad_token": "<pad>"})
|
||||||
|
|
||||||
image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
|
image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
|
||||||
|
@ -58,7 +58,7 @@ def convert_vipllava_llama_to_hf(text_model_id, vision_model_id, output_hub_path
|
|||||||
text_config = AutoConfig.from_pretrained(text_model_id)
|
text_config = AutoConfig.from_pretrained(text_model_id)
|
||||||
|
|
||||||
tokenizer = AutoTokenizer.from_pretrained(text_model_id)
|
tokenizer = AutoTokenizer.from_pretrained(text_model_id)
|
||||||
tokenizer.add_tokens(AddedToken("<image>", special=True, normalized=False))
|
tokenizer.add_tokens(AddedToken("<image>", special=True, normalized=False), special_tokens=True)
|
||||||
tokenizer.add_special_tokens({"pad_token": "<pad>"})
|
tokenizer.add_special_tokens({"pad_token": "<pad>"})
|
||||||
|
|
||||||
image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
|
image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user