🚀 The feature, motivation and pitch
#9160 first introduced AutoWeightsLoader to recursively call load_weights on sub-modules. This lets composite models (most notably multi-modal models) use language backbones (*Model classes such as LlamaModel) without having to repeat their weight loading logic.
Currently, load_weights is only implemented in a few language backbones. It would be great to standardize this approach and apply it to all language backbones in vLLM. The steps to do this are pretty straightforward:
- Move the existing
load_weights function from *ForCausalLM to *Model.
- Create a new
load_weights function in *ForCausalLM that loads the weights using AutoWeightsLoader.
- Move any logic in
*Model.load_weights that only applies to *ForCausalLM back to *ForCausalLM.load_weights. Usually, this involves lm_head.
For reference, you can look at the implementation for models such as Llama, Gemma2/3, Qwen2 and ChatGLM.
To avoid scope creep, I suggest opening a PR for updating only a few models at a time
Alternatives
No response
Additional context
No response
Before submitting a new issue...
🚀 The feature, motivation and pitch
#9160 first introduced
AutoWeightsLoaderto recursively callload_weightson sub-modules. This lets composite models (most notably multi-modal models) use language backbones (*Modelclasses such asLlamaModel) without having to repeat their weight loading logic.Currently,
load_weightsis only implemented in a few language backbones. It would be great to standardize this approach and apply it to all language backbones in vLLM. The steps to do this are pretty straightforward:load_weightsfunction from*ForCausalLMto*Model.load_weightsfunction in*ForCausalLMthat loads the weights usingAutoWeightsLoader.*Model.load_weightsthat only applies to*ForCausalLMback to*ForCausalLM.load_weights. Usually, this involveslm_head.For reference, you can look at the implementation for models such as Llama, Gemma2/3, Qwen2 and ChatGLM.
To avoid scope creep, I suggest opening a PR for updating only a few models at a time
Alternatives
No response
Additional context
No response
Before submitting a new issue...