|
|
--- |
|
|
library_name: residuals |
|
|
base_model: ibm-granite/granite-4.0-h-micro-base |
|
|
base_model_relation: adapter |
|
|
instruct_model: ibm-granite/granite-4.0-h-micro |
|
|
pipeline_tag: text-generation |
|
|
tags: |
|
|
- residuals |
|
|
- delta |
|
|
- task-arithmetic |
|
|
- finetune |
|
|
--- |
|
|
|
|
|
|
|
|
# Instruction Residuals |
|
|
|
|
|
This repository contains instruction residuals (delta weights) computed as the parameter-wise difference between `ibm-granite/granite-4.0-h-micro` and `ibm-granite/granite-4.0-h-micro-base`. |
|
|
|
|
|
Apply these residuals to the base model to reconstruct the instruction-tuned weights without retraining. |
|
|
|
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
from residuals import Residuals |
|
|
|
|
|
base = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-4.0-h-micro-base") |
|
|
tok = AutoTokenizer.from_pretrained("ibm-granite/granite-4.0-h-micro-base") |
|
|
|
|
|
res = Residuals.from_pretrained("residuals/granite-4.0-h-micro") |
|
|
res.apply(base, base_tokenizer=tok) |
|
|
``` |
|
|
|
|
|
|
|
|
## Provenance |
|
|
- **Created at**: 2025-10-25T17:40:59.623585+00:00 |
|
|
- **DType**: float32 |
|
|
- **Parameters**: 467 |
|
|
- **Shapes hash**: 910db9fc5770fda73a85ced6cea0e6e2a053e0346b9eac50091b0dae3023ad59 |
|
|
- **Names hash**: 82d0aee30bf5d9833ffe7352a9e912760015befabf4dddd308608cbc395977ec |
|
|
- **Base model**: `ibm-granite/granite-4.0-h-micro-base` |
|
|
- **Instruction model**: `ibm-granite/granite-4.0-h-micro` |
|
|
|
|
|
## Files |
|
|
- **model.safetensors**: Serialized residual tensors (safetensors format). |
|
|
- (optional) **model.safetensors.index.json** + shard files `model-00001-of-000N.safetensors`, ... for multi-part weights. |
|
|
- **config.json**: Residuals metadata and provenance. |
|
|
- **tokenizer files**: Saved tokenizer for compatibility. |
|
|
|
|
|
## About this format |
|
|
These are additive residuals (task vectors). Applying them to the base model's parameters reconstructs the instruction-tuned model. |
|
|
|
|
|
## Tools |
|
|
Generated with the `residuals` Python package. Install via: `pip install residuals`. |
|
|
- PyPI: https://pypi.org/project/residuals/ |
|
|
- Source: https://github.com/omarish/residuals |
|
|
|