fusion-bench 0.2.24__py3-none-any.whl → 0.2.26__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.
- fusion_bench/__init__.py +152 -42
- fusion_bench/dataset/__init__.py +27 -4
- fusion_bench/dataset/clip_dataset.py +2 -2
- fusion_bench/method/__init__.py +12 -1
- fusion_bench/method/classification/__init__.py +27 -2
- fusion_bench/method/classification/clip_finetune.py +6 -4
- fusion_bench/method/classification/image_classification_finetune.py +214 -0
- fusion_bench/method/dop/__init__.py +1 -0
- fusion_bench/method/dop/dop.py +366 -0
- fusion_bench/method/dop/min_norm_solvers.py +227 -0
- fusion_bench/method/dop/utils.py +73 -0
- fusion_bench/method/opcm/opcm.py +1 -0
- fusion_bench/method/pwe_moe/module.py +0 -2
- fusion_bench/method/tall_mask/task_arithmetic.py +2 -2
- fusion_bench/mixins/__init__.py +2 -0
- fusion_bench/mixins/pyinstrument.py +174 -0
- fusion_bench/mixins/simple_profiler.py +106 -23
- fusion_bench/modelpool/__init__.py +2 -0
- fusion_bench/modelpool/base_pool.py +77 -14
- fusion_bench/modelpool/clip_vision/modelpool.py +56 -19
- fusion_bench/modelpool/resnet_for_image_classification.py +208 -0
- fusion_bench/models/__init__.py +35 -9
- fusion_bench/optim/__init__.py +40 -2
- fusion_bench/optim/lr_scheduler/__init__.py +27 -1
- fusion_bench/optim/muon.py +339 -0
- fusion_bench/programs/__init__.py +2 -0
- fusion_bench/programs/fabric_fusion_program.py +2 -2
- fusion_bench/programs/fusion_program.py +271 -0
- fusion_bench/tasks/clip_classification/__init__.py +15 -0
- fusion_bench/utils/__init__.py +167 -21
- fusion_bench/utils/lazy_imports.py +91 -12
- fusion_bench/utils/lazy_state_dict.py +55 -5
- fusion_bench/utils/misc.py +104 -13
- fusion_bench/utils/packages.py +4 -0
- fusion_bench/utils/path.py +7 -0
- fusion_bench/utils/pylogger.py +6 -0
- fusion_bench/utils/rich_utils.py +1 -0
- fusion_bench/utils/state_dict_arithmetic.py +935 -162
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/METADATA +8 -2
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/RECORD +75 -56
- fusion_bench_config/method/bitdelta/bitdelta.yaml +3 -0
- fusion_bench_config/method/classification/image_classification_finetune.yaml +16 -0
- fusion_bench_config/method/classification/image_classification_finetune_test.yaml +6 -0
- fusion_bench_config/method/depth_upscaling.yaml +9 -0
- fusion_bench_config/method/dop/dop.yaml +30 -0
- fusion_bench_config/method/dummy.yaml +6 -0
- fusion_bench_config/method/ensemble/max_model_predictor.yaml +6 -0
- fusion_bench_config/method/ensemble/simple_ensemble.yaml +8 -1
- fusion_bench_config/method/ensemble/weighted_ensemble.yaml +8 -0
- fusion_bench_config/method/linear/linear_interpolation.yaml +8 -0
- fusion_bench_config/method/linear/weighted_average.yaml +3 -0
- fusion_bench_config/method/linear/weighted_average_for_llama.yaml +1 -1
- fusion_bench_config/method/model_recombination.yaml +8 -0
- fusion_bench_config/method/model_stock/model_stock.yaml +4 -1
- fusion_bench_config/method/opcm/opcm.yaml +5 -0
- fusion_bench_config/method/opcm/task_arithmetic.yaml +6 -0
- fusion_bench_config/method/opcm/ties_merging.yaml +5 -0
- fusion_bench_config/method/opcm/weight_average.yaml +5 -0
- fusion_bench_config/method/simple_average.yaml +9 -0
- fusion_bench_config/method/slerp/slerp.yaml +9 -0
- fusion_bench_config/method/slerp/slerp_lm.yaml +5 -0
- fusion_bench_config/method/smile_upscaling/smile_upscaling.yaml +3 -0
- fusion_bench_config/method/task_arithmetic.yaml +9 -0
- fusion_bench_config/method/ties_merging.yaml +3 -0
- fusion_bench_config/model_fusion.yaml +45 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet152_cifar10.yaml +14 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet152_cifar100.yaml +14 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet18_cifar10.yaml +14 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet18_cifar100.yaml +14 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet50_cifar10.yaml +14 -0
- fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet50_cifar100.yaml +14 -0
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/WHEEL +0 -0
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/entry_points.txt +0 -0
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/licenses/LICENSE +0 -0
- {fusion_bench-0.2.24.dist-info → fusion_bench-0.2.26.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Method Configuration: Spherical Linear Interpolation (SLERP)
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Interpolates between two parameter vectors on a hypersphere.
|
|
5
|
+
#
|
|
6
|
+
# - t in [0,1]: interpolation factor; 0 returns model0; 1 returns model1.
|
|
7
|
+
# - DOT_THRESHOLD: threshold to switch to linear interpolation when vectors are near-aligned.
|
|
8
|
+
# - epsilon: small constant to avoid division by zero.
|
|
9
|
+
# =============================================================================
|
|
1
10
|
_target_: fusion_bench.method.SlerpMergeAlgorithm
|
|
2
11
|
t: 0.5 # interpolation factor
|
|
3
12
|
DOT_THRESHOLD: 0.9995
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Method Configuration: SLERP for Causal LM
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Spherical linear interpolation between two causal language models.
|
|
5
|
+
# =============================================================================
|
|
1
6
|
_target_: fusion_bench.method.SlerpForCausalLM
|
|
2
7
|
t: 0.5
|
|
3
8
|
model_save_path: ${path.log_dir}/checkpoint
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Method Configuration: SMILE Upscaling
|
|
3
|
+
# =============================================================================
|
|
1
4
|
_target_: fusion_bench.method.SmileUpscalingAlgorithm
|
|
2
5
|
# merge device on cuda can accelerate the SVD computation
|
|
3
6
|
device: cpu
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Method Configuration: Task Arithmetic
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Performs task vector arithmetic: base + lambda * \sum_i (task_i - base).
|
|
5
|
+
#
|
|
6
|
+
# Notes
|
|
7
|
+
# - scaling_factor controls the contribution of the task delta.
|
|
8
|
+
# - Model compatibility is required (matching parameter shapes).
|
|
9
|
+
# =============================================================================
|
|
1
10
|
_target_: fusion_bench.method.TaskArithmeticAlgorithm
|
|
2
11
|
scaling_factor: 0.3
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Method Configuration: Ties Merging
|
|
3
|
+
# =============================================================================
|
|
1
4
|
_target_: fusion_bench.method.TiesMergingAlgorithm
|
|
2
5
|
# Scaling factor $\lambda$
|
|
3
6
|
scaling_factor: 0.3
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# FusionBench Model Fusion Configuration
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# This configuration file defines the settings for running model fusion experiments
|
|
5
|
+
# within FusionBench using standard PyTorch (without Lightning Fabric).
|
|
6
|
+
#
|
|
7
|
+
# The configuration includes:
|
|
8
|
+
#
|
|
9
|
+
# - Hydra framework settings and overrides
|
|
10
|
+
# - Path management for data, outputs, and logs
|
|
11
|
+
# - (core components) Model pool, fusion method, and task pool specifications
|
|
12
|
+
# - Experiment execution parameters and debugging options
|
|
13
|
+
#
|
|
14
|
+
# =============================================================================
|
|
15
|
+
# Hydra Configuration Defaults
|
|
16
|
+
# =============================================================================
|
|
17
|
+
defaults:
|
|
18
|
+
- hydra: default # Hydra framework configuration
|
|
19
|
+
- path: default # Path management configuration
|
|
20
|
+
# --- Core Components ---
|
|
21
|
+
- modelpool: CLIPVisionModelPool/clip-vit-base-patch32_TA8 # Model pool specification
|
|
22
|
+
- method: dummy # Fusion method (placeholder)
|
|
23
|
+
- taskpool: dummy # Task pool specification (placeholder)
|
|
24
|
+
- _self_ # Self-reference for override priority
|
|
25
|
+
# =============================================================================
|
|
26
|
+
# Program Configuration
|
|
27
|
+
# =============================================================================
|
|
28
|
+
_target_: fusion_bench.programs.ModelFusionProgram
|
|
29
|
+
_recursive_: false # Disable recursive instantiation
|
|
30
|
+
# =============================================================================
|
|
31
|
+
# Experiment Execution Settings
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# Development and debugging options
|
|
34
|
+
fast_dev_run: false # This option is for quick testing. For example, run single batch instead of full dataset
|
|
35
|
+
dry_run: false # Show configuration without running experiment
|
|
36
|
+
print_config: true # Display full configuration before execution
|
|
37
|
+
print_function_call: true # Show detailed instantiation calls
|
|
38
|
+
# =============================================================================
|
|
39
|
+
# Output and Logging Configuration
|
|
40
|
+
# =============================================================================
|
|
41
|
+
# Model saving configuration
|
|
42
|
+
merged_model_save_path: null # Path to save merged model.
|
|
43
|
+
merged_model_save_kwargs: null # Additional kwargs for model saving.
|
|
44
|
+
# Report generation
|
|
45
|
+
report_save_path: "{log_dir}/program_report.json" # Experiment results report path
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar10
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar10
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-152
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar10
|
fusion_bench_config/modelpool/ResNetForImageClassfication/transformers/resnet152_cifar100.yaml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar100
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar100
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-152
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar100
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar10
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar10
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-18
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar10
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar100
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar100
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-18
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar100
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar10
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar10
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-50
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar10
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
defaults:
|
|
2
|
+
- /dataset/image_classification/train@train_datasets:
|
|
3
|
+
- cifar100
|
|
4
|
+
- /dataset/image_classification/test@val_datasets:
|
|
5
|
+
- cifar100
|
|
6
|
+
- _self_
|
|
7
|
+
_target_: fusion_bench.modelpool.ResNetForImageClassificationPool
|
|
8
|
+
_recursive_: False
|
|
9
|
+
type: transformers
|
|
10
|
+
models:
|
|
11
|
+
_pretrained_:
|
|
12
|
+
config_path: microsoft/resnet-50
|
|
13
|
+
pretrained: true
|
|
14
|
+
dataset_name: cifar100
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|