lighteval
lighteval copied to clipboard
Allow AdapterModels to have custom tokens
PEFT has a feature for adapters to add tokens to a model: https://github.com/huggingface/peft/blob/main/examples/causal_language_modeling/peft_lora_clm_with_additional_tokens.ipynb
When using an AdapterModel with new tokens in LightEval, the script fails because:
-
AdapterModel._create_auto_tokenizeralways uses the base model path, without checkingconfig.tokenizer - the new tokenizer and base model will have a mismatched number of embeddings
Notebook with error: https://colab.research.google.com/drive/1AMJ6_MiZGFTBf8KdRn-zj7soKyZrzpbf?usp=sharing
This PR would create the tokenizer from config.tokenizer or config.base_model
and run base.resize_token_embeddings(...) before PeftModel.from_pretrained(base, adapter_weights)
This is based on my fix for llm-evaluation-harness: https://github.com/EleutherAI/lm-evaluation-harness/pull/1828
Notes:
- +1 please merge #298 (cherry-picked here), their one-line fix passed
model_config_pathto AdapterModel and this is necessary for most advanced models - opinion: I think that
adapter_weightsanddelta_weightsshould be optional so I do not needdelta_weights: falsein my config