This commit is contained in:
Daniel Han 2024-10-27 19:09:27 -07:00
commit e4205ffad5
2 changed files with 8 additions and 8 deletions

View file

@ -613,10 +613,10 @@ def patch_tokenizer(model, tokenizer):
# Edit all config with new pad token
current_model = model
while hasattr(model, "model") and hasattr(model, "config"):
while hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
current_model = current_model.model
if hasattr(model, "model") and hasattr(model, "config"):
if hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
pass
@ -630,10 +630,10 @@ def patch_tokenizer(model, tokenizer):
# Edit all config with new pad token
current_model = model
while hasattr(model, "model") and hasattr(model, "config"):
while hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
current_model = model
if hasattr(model, "model") and hasattr(model, "config"):
if hasattr(current_model, "model") and hasattr(current_model, "config"):
current_model.config.update({"pad_token_id" : tokenizer.pad_token_id})
pass

View file

@ -1849,12 +1849,12 @@ class FastLlamaModel:
# Fix up all vocab sizes
current_model = model
while hasattr(model, "model") and hasattr(model, "config"):
if hasattr(model.config, "vocab_size"):
while hasattr(current_model, "model") and hasattr(current_model, "config"):
if hasattr(current_model.config, "vocab_size"):
current_model.config.update({"vocab_size" : len(tokenizer)})
current_model = current_model.model
if hasattr(model, "model") and hasattr(model, "config"):
if hasattr(model.config, "vocab_size"):
if hasattr(current_model, "model") and hasattr(current_model, "config"):
if hasattr(current_model.config, "vocab_size"):
current_model.config.update({"vocab_size" : len(tokenizer)})
pass
pass