Skip to content

Commit 77325a3

Browse files
jiangzeyinzizeyinzi.jzyz
andauthored
ResTuning readme (#129)
Co-authored-by: zeyinzi.jzyz <[email protected]>
1 parent 1e15756 commit 77325a3

File tree

3 files changed

+65
-2
lines changed

3 files changed

+65
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Currently supported approches (and counting):
2424
4. Adapter: [Parameter-Efficient Transfer Learning for NLP](http://arxiv.org/abs/1902.00751)
2525
5. Prompt Tuning: [Visual Prompt Tuning](https://arxiv.org/abs/2203.12119)
2626
6. Side: [Side-Tuning: A Baseline for Network Adaptation via Additive Side Networks](https://arxiv.org/abs/1912.13503)
27-
7. ResTuning-Bypass
27+
7. Res-Tuning: [Res-Tuning: A Flexible and Efficient Tuning Paradigm via Unbinding Tuner from Backbone](https://arxiv.org/abs/2310.19859) < [arXiv](https://arxiv.org/abs/2310.19859) | [Project Page](https://res-tuning.github.io/) | [Usage](docs/source/GetStarted/ResTuning.md) >
2828
8. ROME: [Rank-One Editing of Encoder-Decoder Models](https://arxiv.org/abs/2211.13317)
2929
9. All tuners offered on [PEFT](https://github.com/huggingface/peft)
3030

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SWIFT(Scalable lightWeight Infrastructure for Fine-Tuning)是一个可扩展
2323
4. Adapter:[Parameter-Efficient Transfer Learning for NLP](http://arxiv.org/abs/1902.00751)
2424
5. Prompt: [Visual Prompt Tuning](https://arxiv.org/abs/2203.12119)
2525
6. Side: [Side-Tuning: A Baseline for Network Adaptation via Additive Side Networks](https://arxiv.org/abs/1912.13503)
26-
7. ResTuning-Bypass
26+
7. Res-Tuning: [Res-Tuning: A Flexible and Efficient Tuning Paradigm via Unbinding Tuner from Backbone](https://arxiv.org/abs/2310.19859) < [arXiv](https://arxiv.org/abs/2310.19859) | [Project Page](https://res-tuning.github.io/) | [Usage](docs/source/GetStarted/ResTuning.md) >
2727
8. ROME: [Rank-One Editing of Encoder-Decoder Models](https://arxiv.org/abs/2211.13317)
2828
9. 所有在[PEFT](https://github.com/huggingface/peft)上提供的tuners
2929

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<div align="center">
2+
3+
## [NeurIPS 2023] Res-Tuning: A Flexible and Efficient Tuning Paradigm via Unbinding Tuner from Backbone
4+
5+
### [arXiv](https://arxiv.org/abs/2310.19859) | [Project Page](https://res-tuning.github.io/)
6+
7+
</div>
8+
9+
Res-Tuning is a flexible and efficient tuning paradigm. We manage to free the design of tuners from the network architecture, facilitating flexible combination of various tuning strategies and further extend a memory-efficient bypass variant, which significantly reduces the memory consumption and multi-task inference cost.
10+
11+
The implementation is a pluggable tuner component for [SWIFT](https://github.com/modelscope/swift), designed to be user-friendly.
12+
13+
### Catalog
14+
15+
- [x] Res-Adapter
16+
- [x] Res-Tuning-Bypass
17+
- [ ] Res-Prefix
18+
- [ ] Res-Prompt
19+
20+
### Usage
21+
22+
#### Demo
23+
- Run our interactive demo using [vision_example](https://github.com/modelscope/swift/blob/main/examples/pytorch/cv/notebook/swift_vision.ipynb).
24+
25+
#### Init Tuner
26+
27+
```Python
28+
from swift import ResTuningConfig
29+
config = ResTuningConfig(
30+
dims=768,
31+
root_modules=r'.*blocks.0$',
32+
stem_modules=r'.*blocks\.\d+$',
33+
target_modules=r'norm',
34+
tuner_cfg='res_adapter'
35+
)
36+
```
37+
- dims: The dimensions of the hidden states.
38+
- root_modules: The root module to be replaced.
39+
- stem_modules: The stem modules to be replaced.
40+
- target_modules: The target module to be replaced.
41+
- tuner_cfg: The configuration of the tuning module.
42+
43+
#### Load Model
44+
45+
```Python
46+
from swift import Swift
47+
import timm, torch
48+
model = timm.create_model("vit_base_patch16_224", pretrained=False, num_classes=100)
49+
model_tune = Swift.prepare_model(model, config)
50+
print(model_tune.get_trainable_parameters())
51+
print(model(torch.ones(1, 3, 224, 224)).shape)
52+
```
53+
54+
55+
### Citation
56+
```
57+
@inproceedings{jiang2023restuning,
58+
title={Res-Tuning: A Flexible and Efficient Tuning Paradigm via Unbinding Tuner from Backbone},
59+
author={Jiang, Zeyinzi and Mao, Chaojie and Huang, Ziyuan and Ma, Ao and Lv, Yiliang and Shen, Yujun and Zhao, Deli and Zhou, Jingren},
60+
booktitle={Advances in Neural Information Processing Systems},
61+
year={2023}
62+
}
63+
```

0 commit comments

Comments
 (0)