fusion-bench 0.2.10__py3-none-any.whl → 0.2.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. fusion_bench/compat/method/__init__.py +5 -0
  2. fusion_bench/dataset/fer2013.py +0 -1
  3. fusion_bench/method/__init__.py +10 -0
  4. fusion_bench/method/adamerging/clip_layer_wise_adamerging.py +1 -1
  5. fusion_bench/method/concrete_subspace/__init__.py +8 -0
  6. fusion_bench/method/concrete_subspace/clip_post_defense.py +744 -0
  7. fusion_bench/method/concrete_subspace/clip_safe_concrete_adamerging.py +832 -0
  8. fusion_bench/method/doge_ta/__init__.py +2 -0
  9. fusion_bench/method/doge_ta/clip_layer_wise_adamerging.py +46 -0
  10. fusion_bench/method/doge_ta/doge_ta.py +364 -0
  11. fusion_bench/method/doge_ta/layer_wise_adamerging.py +250 -0
  12. fusion_bench/method/isotropic_merging/__init__.py +1 -1
  13. fusion_bench/method/isotropic_merging/iso.py +2 -2
  14. fusion_bench/method/opcm/opcm.py +93 -84
  15. fusion_bench/method/opcm/task_arithmetic.py +35 -21
  16. fusion_bench/method/opcm/ties_merging.py +71 -52
  17. fusion_bench/method/task_singular_vector/TSVM.py +3 -3
  18. fusion_bench/models/wrappers/layer_wise_fusion.py +1 -46
  19. fusion_bench/models/wrappers/layer_wise_fusion_doge_ta.py +416 -0
  20. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info}/METADATA +15 -2
  21. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info}/RECORD +32 -19
  22. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info}/WHEEL +1 -1
  23. fusion_bench_config/method/concrete_subspace/clip_post_defense_AWM.yaml +38 -0
  24. fusion_bench_config/method/concrete_subspace/clip_post_defense_SAU.yaml +41 -0
  25. fusion_bench_config/method/concrete_subspace/clip_safe_concrete_layer_wise_adamerging.yaml +39 -0
  26. fusion_bench_config/method/concrete_subspace/clip_safe_concrete_task_arithmetic.yaml +40 -0
  27. fusion_bench_config/method/doge_ta/doge_ta.yaml +4 -0
  28. fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_glue_lora16_tta.yaml +8 -8
  29. fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_glue_tta.yaml +68 -0
  30. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info}/entry_points.txt +0 -0
  31. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info/licenses}/LICENSE +0 -0
  32. {fusion_bench-0.2.10.dist-info → fusion_bench-0.2.12.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,41 @@
1
+ # Reference: Jinluan Yang, et al. Mitigating the Backdoor Effect for Multi-Task Model Merging via Safety-Aware Subspace. ICLR 2025.
2
+
3
+ name: clip_post_defense_SAU
4
+
5
+ # batch size per gpu
6
+ # if you have multiple gpus, the total batch size will be `batch_size * num_gpus`
7
+ batch_size: 16
8
+ num_workers: 8
9
+
10
+ optimizer: adam
11
+ lr: 1e-3
12
+
13
+ scaling_factor: 0.3
14
+
15
+ ###new
16
+ adv_lr: 1e-4
17
+ trigger_norm: 1000
18
+ adv_weight: 0.01
19
+ shared_weight: 0.01
20
+ beta1: 0.5
21
+ beta2: 0.5
22
+
23
+
24
+ max_steps: 2000
25
+ save_interval: 500
26
+ initial_logits: 0
27
+ temperature: 0.5
28
+
29
+ # "discrete" or "continuous", this is the mask applied for evaluation, not during training
30
+ # the performance of final model are expected to be similar
31
+ eval_mask_type: continuous
32
+
33
+ mask_checkpoint: null
34
+ # if `clamp_weights` is true, the weights will be clamped to [0, 1]
35
+ clamp_weights: false
36
+
37
+ # arguments of `functional_call`
38
+ tie_weights: true
39
+ strict: false
40
+
41
+ cache_dir: outputs
@@ -0,0 +1,39 @@
1
+ # Reference: Jinluan Yang, et al. Mitigating the Backdoor Effect for Multi-Task Model Merging via Safety-Aware Subspace. ICLR 2025.
2
+
3
+ name: clip_safe_concrete_layer_wise_adamerging
4
+
5
+ # batch size per gpu
6
+ # if you have multiple gpus, the total batch size will be `batch_size * num_gpus`
7
+ batch_size: 16
8
+ num_workers: 8
9
+
10
+ optimizer: adam
11
+ lr: 1e-3
12
+ base_lr: 1
13
+ adamerging_lr: 1e-3
14
+
15
+ scaling_factor: 0.3
16
+
17
+ max_steps: 1000
18
+ max_adamerging_steps: 1000
19
+ save_interval: 500
20
+ initial_logits: 0
21
+ temperature: 0.5
22
+
23
+ ###new
24
+ adv_lr: 1e-4
25
+ trigger_norm: 1000
26
+ adv_weight: 0.1
27
+ # "discrete" or "continuous", this is the mask applied for evaluation, not during training
28
+ # the performance of final model are expected to be similar
29
+ eval_mask_type: continuous
30
+
31
+ mask_checkpoint: null
32
+ # if `clamp_weights` is true, the weights will be clamped to [0, 1]
33
+ clamp_weights: false
34
+
35
+ # arguments of `functional_call`
36
+ tie_weights: true
37
+ strict: false
38
+
39
+ cache_dir: outputs
@@ -0,0 +1,40 @@
1
+ # Reference: Jinluan Yang, et al. Mitigating the Backdoor Effect for Multi-Task Model Merging via Safety-Aware Subspace. ICLR 2025.
2
+
3
+ name: clip_safe_concrete_task_arithmetic
4
+
5
+ # batch size per gpu
6
+ # if you have multiple gpus, the total batch size will be `batch_size * num_gpus`
7
+ batch_size: 16
8
+ num_workers: 8
9
+
10
+ optimizer: adam
11
+ lr: 1e-3
12
+
13
+ scaling_factor: 0.3
14
+
15
+
16
+
17
+ ###new
18
+ adv_lr: 1e-4
19
+ trigger_norm: 1000
20
+ adv_weight: 0.1
21
+
22
+
23
+ max_steps: 2000
24
+ save_interval: 500
25
+ initial_logits: 0
26
+ temperature: 0.5
27
+
28
+ # "discrete" or "continuous", this is the mask applied for evaluation, not during training
29
+ # the performance of final model are expected to be similar
30
+ eval_mask_type: continuous
31
+
32
+ mask_checkpoint: null
33
+ # if `clamp_weights` is true, the weights will be clamped to [0, 1]
34
+ clamp_weights: false
35
+
36
+ # arguments of `functional_call`
37
+ tie_weights: true
38
+ strict: false
39
+
40
+ cache_dir: outputs
@@ -0,0 +1,4 @@
1
+ _target_: fusion_bench.method.DOGE_TA_Algorithm
2
+ subspace: 6
3
+ K: 30
4
+ lamda: 0.07
@@ -1,14 +1,14 @@
1
1
  defaults:
2
2
  - /model/flan-t5@models:
3
3
  - flan-t5-base
4
- - flan-t5-base_glue-cola
5
- - flan-t5-base_glue-mnli
6
- - flan-t5-base_glue-mrpc
7
- - flan-t5-base_glue-qnli
8
- - flan-t5-base_glue-qqp
9
- - flan-t5-base_glue-rte
10
- - flan-t5-base_glue-sst2
11
- - flan-t5-base_glue-stsb
4
+ - flan-t5-base_glue-cola_lora-16
5
+ - flan-t5-base_glue-mnli_lora-16
6
+ - flan-t5-base_glue-mrpc_lora-16
7
+ - flan-t5-base_glue-qnli_lora-16
8
+ - flan-t5-base_glue-qqp_lora-16
9
+ - flan-t5-base_glue-rte_lora-16
10
+ - flan-t5-base_glue-sst2_lora-16
11
+ - flan-t5-base_glue-stsb_lora-16
12
12
  _target_: fusion_bench.modelpool.Seq2SeqLMPool
13
13
  _recursive_: false
14
14
 
@@ -0,0 +1,68 @@
1
+ defaults:
2
+ - /model/flan-t5@models:
3
+ - flan-t5-base
4
+ - flan-t5-base_glue-cola
5
+ - flan-t5-base_glue-mnli
6
+ - flan-t5-base_glue-mrpc
7
+ - flan-t5-base_glue-qnli
8
+ - flan-t5-base_glue-qqp
9
+ - flan-t5-base_glue-rte
10
+ - flan-t5-base_glue-sst2
11
+ - flan-t5-base_glue-stsb
12
+ _target_: fusion_bench.modelpool.Seq2SeqLMPool
13
+ _recursive_: false
14
+
15
+ _dataset_loader: fusion_bench.tasks.flan_t5_text_generation.glue_load_dataset.load_glue_dataset
16
+ test_datasets:
17
+ glue-cola:
18
+ _target_: ${..._dataset_loader}
19
+ _recursive_: false
20
+ name: cola
21
+ tokenizer: ${...tokenizer}
22
+ split: validation
23
+ glue-mnli:
24
+ _target_: ${..._dataset_loader}
25
+ _recursive_: false
26
+ name: mnli
27
+ tokenizer: ${...tokenizer}
28
+ split: validation_matched
29
+ glue-mrpc:
30
+ _target_: ${..._dataset_loader}
31
+ _recursive_: false
32
+ name: mrpc
33
+ tokenizer: ${...tokenizer}
34
+ split: validation
35
+ glue-qnli:
36
+ _target_: ${..._dataset_loader}
37
+ _recursive_: false
38
+ name: qnli
39
+ tokenizer: ${...tokenizer}
40
+ split: validation
41
+ glue-qqp:
42
+ _target_: ${..._dataset_loader}
43
+ _recursive_: false
44
+ name: qqp
45
+ tokenizer: ${...tokenizer}
46
+ split: validation
47
+ glue-rte:
48
+ _target_: ${..._dataset_loader}
49
+ _recursive_: false
50
+ name: rte
51
+ tokenizer: ${...tokenizer}
52
+ split: validation
53
+ glue-sst2:
54
+ _target_: ${..._dataset_loader}
55
+ _recursive_: false
56
+ name: sst2
57
+ tokenizer: ${...tokenizer}
58
+ split: validation
59
+ glue-stsb:
60
+ _target_: ${..._dataset_loader}
61
+ _recursive_: false
62
+ name: stsb
63
+ tokenizer: ${...tokenizer}
64
+ split: validation
65
+
66
+ tokenizer:
67
+ _target_: transformers.AutoTokenizer.from_pretrained
68
+ pretrained_model_name_or_path: google/flan-t5-base