Skip to content

Commit

Permalink
[Llava] Fix convert_llava_weights_to_hf.py script (#28570)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
isaac-vidas authored Jan 19, 2024
1 parent faf0354 commit 5b7f4bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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>"})

image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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>"})

image_processor = CLIPImageProcessor.from_pretrained(vision_model_id)
Expand Down

0 comments on commit 5b7f4bc

Please sign in to comment.