Toolkit for attaching, training, saving, and loading new heads for transformer models
Top 93.1% on sourcepulse
This library provides a toolkit for attaching, training, saving, and loading custom "heads" onto pre-trained transformer models. It enables researchers and practitioners to easily adapt large language models for new tasks, such as linear probing for interpretability, fine-tuning for classification or regression, and multi-task learning, thereby enhancing model versatility and facilitating efficient experimentation.
How It Works
The core approach involves defining HeadConfig
objects that specify the desired head's properties, including its attachment layer, input/output dimensions, activation function, loss function, and target data column. The load_headed
function then seamlessly integrates these heads by replacing or augmenting the transformer's original output layer. This modular design allows for flexible experimentation with various downstream tasks and training strategies, including efficient methods like QLoRA.
Quick Start & Requirements
pip install transformer-heads
pip install -e .
Highlighted Details
Trainer
for simplified training workflows.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The README does not explicitly state the license, which could be a concern for commercial adoption. Support for custom model architectures relies on them having a similar attribute structure to Hugging Face's LlamaForCausalLM
, requiring potential modifications for non-standard models.
5 months ago
1 day