fusion-bench 0.2.9__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 +20 -0
- fusion_bench/__main__.py +4 -0
- fusion_bench/compat/__init__.py +0 -0
- fusion_bench/compat/method/__init__.py +109 -0
- fusion_bench/compat/method/base_algorithm.py +58 -0
- fusion_bench/compat/modelpool/AutoModelForSeq2SeqLM.py +34 -0
- fusion_bench/compat/modelpool/__init__.py +116 -0
- fusion_bench/compat/modelpool/base_pool.py +328 -0
- fusion_bench/compat/modelpool/huggingface_clip_vision.py +178 -0
- fusion_bench/compat/taskpool/__init__.py +95 -0
- fusion_bench/compat/taskpool/base_pool.py +111 -0
- fusion_bench/compat/taskpool/clip_image_classification.py +210 -0
- fusion_bench/compat/taskpool/flan_t5_glue_text_generation.py +175 -0
- fusion_bench/constants/__init__.py +2 -0
- fusion_bench/constants/paths.py +18 -0
- fusion_bench/dataset/__init__.py +29 -0
- fusion_bench/dataset/arc_agi/__init__.py +6 -0
- fusion_bench/dataset/arc_agi/arc.py +308 -0
- fusion_bench/dataset/arc_agi/arc_agi.py +365 -0
- fusion_bench/dataset/arc_agi/augmenters.py +1036 -0
- fusion_bench/dataset/arc_agi/messagers.py +1355 -0
- fusion_bench/dataset/arc_agi/np_cache.py +168 -0
- fusion_bench/dataset/arc_agi/preprocess.py +298 -0
- fusion_bench/dataset/arc_agi/representers.py +1019 -0
- fusion_bench/dataset/clip_dataset.py +71 -0
- fusion_bench/dataset/fer2013.py +12 -0
- fusion_bench/dataset/gpt2_glue.py +300 -0
- fusion_bench/dataset/gsm8k.py +60 -0
- fusion_bench/dataset/image_dataset.py +55 -0
- fusion_bench/dataset/imdb.py +11 -0
- fusion_bench/dataset/llama/__init__.py +1 -0
- fusion_bench/dataset/llama/alpaca.py +232 -0
- fusion_bench/dataset/llama/collate.py +120 -0
- fusion_bench/dataset/llama/metamathqa.py +50 -0
- fusion_bench/dataset/llama/openai.py +160 -0
- fusion_bench/dataset/llama/preference_700k.py +70 -0
- fusion_bench/dataset/llama/sharegpt.py +141 -0
- fusion_bench/dataset/llama/squad.py +125 -0
- fusion_bench/dataset/llama/stanford_shp.py +90 -0
- fusion_bench/dataset/llama/ultrachat.py +58 -0
- fusion_bench/dataset/llama/utils/__init__.py +0 -0
- fusion_bench/dataset/llama/wikitext.py +89 -0
- fusion_bench/dataset/nyuv2.py +119 -0
- fusion_bench/method/__init__.py +177 -0
- fusion_bench/method/ada_svd/__init__.py +2 -0
- fusion_bench/method/ada_svd/clip_vision.py +319 -0
- fusion_bench/method/adamerging/__init__.py +6 -0
- fusion_bench/method/adamerging/clip_layer_wise_adamerging.py +46 -0
- fusion_bench/method/adamerging/clip_task_wise_adamerging.py +187 -0
- fusion_bench/method/adamerging/entropy_loss.py +25 -0
- fusion_bench/method/adamerging/flan_t5_layer_wise_adamerging.py +332 -0
- fusion_bench/method/adamerging/gpt2_layer_wise_adamerging.py +351 -0
- fusion_bench/method/adamerging/layer_wise_adamerging.py +252 -0
- fusion_bench/method/adamerging/llama_adamerging.py +335 -0
- fusion_bench/method/adamerging/min_norm_solvers.py +227 -0
- fusion_bench/method/adamerging/task_wise_adamerging.py +174 -0
- fusion_bench/method/adamerging/utils.py +15 -0
- fusion_bench/method/analysis/__init__.py +2 -0
- fusion_bench/method/analysis/task_vector_cos_similarity.py +172 -0
- fusion_bench/method/analysis/task_vector_violin_plot.py +205 -0
- fusion_bench/method/base_algorithm.py +44 -0
- fusion_bench/method/classification/__init__.py +3 -0
- fusion_bench/method/classification/clip_finetune.py +444 -0
- fusion_bench/method/classification/continual_clip_finetune.py +297 -0
- fusion_bench/method/concrete_subspace/__init__.py +6 -0
- fusion_bench/method/concrete_subspace/clip_concrete_adamerging.py +595 -0
- fusion_bench/method/concrete_subspace/clip_concrete_task_arithmetic.py +263 -0
- fusion_bench/method/dare/__init__.py +4 -0
- fusion_bench/method/dare/simple_average.py +31 -0
- fusion_bench/method/dare/task_arithmetic.py +82 -0
- fusion_bench/method/dare/ties_merging.py +100 -0
- fusion_bench/method/dare/utils.py +87 -0
- fusion_bench/method/dawe/__init__.py +2 -0
- fusion_bench/method/dawe/dawe_for_clip.py +274 -0
- fusion_bench/method/dawe/warppers/__init__.py +13 -0
- fusion_bench/method/dawe/warppers/dawe_model.py +256 -0
- fusion_bench/method/depth_upscaling/__init__.py +3 -0
- fusion_bench/method/depth_upscaling/depth_upscaling.py +89 -0
- fusion_bench/method/depth_upscaling/depth_upscaling_for_llama.py +57 -0
- fusion_bench/method/dummy.py +35 -0
- fusion_bench/method/ensemble.py +98 -0
- fusion_bench/method/fisher_merging/__init__.py +4 -0
- fusion_bench/method/fisher_merging/clip_fisher_merging.py +191 -0
- fusion_bench/method/fisher_merging/fisher_merging.py +484 -0
- fusion_bench/method/fisher_merging/gpt2_fisher_merging.py +193 -0
- fusion_bench/method/linear/__init__.py +6 -0
- fusion_bench/method/linear/expo.py +118 -0
- fusion_bench/method/linear/linear_interpolation.py +60 -0
- fusion_bench/method/linear/llama_expo.py +229 -0
- fusion_bench/method/linear/simple_average_for_llama.py +54 -0
- fusion_bench/method/linear/task_arithmetic_for_llama.py +57 -0
- fusion_bench/method/lm_finetune/__init__.py +3 -0
- fusion_bench/method/lm_finetune/bradley_terry_rm.py +432 -0
- fusion_bench/method/lm_finetune/causal_lm_pretrain.py +7 -0
- fusion_bench/method/lm_finetune/fullfinetune_sft.py +375 -0
- fusion_bench/method/lm_finetune/peftfinetune_sft.py +370 -0
- fusion_bench/method/mixture_of_experts/__init__.py +7 -0
- fusion_bench/method/mixture_of_experts/mixtral_merging.py +112 -0
- fusion_bench/method/mixture_of_experts/mixtral_upcycling.py +329 -0
- fusion_bench/method/model_recombination.py +121 -0
- fusion_bench/method/opcm/__init__.py +4 -0
- fusion_bench/method/opcm/opcm.py +277 -0
- fusion_bench/method/opcm/task_arithmetic.py +115 -0
- fusion_bench/method/opcm/ties_merging.py +156 -0
- fusion_bench/method/opcm/utils.py +73 -0
- fusion_bench/method/opcm/weight_average.py +120 -0
- fusion_bench/method/pruning/__init__.py +5 -0
- fusion_bench/method/pruning/llama_magnitude_prune.py +202 -0
- fusion_bench/method/pruning/llama_random_prune.py +143 -0
- fusion_bench/method/pruning/llama_wanda_prune.py +359 -0
- fusion_bench/method/pruning/magnitude_diff_pruning.py +180 -0
- fusion_bench/method/pruning/prune_utils.py +165 -0
- fusion_bench/method/pruning/wanda_utils/__init__.py +7 -0
- fusion_bench/method/pruning/wanda_utils/ablate.py +188 -0
- fusion_bench/method/pruning/wanda_utils/data.py +135 -0
- fusion_bench/method/pruning/wanda_utils/eval.py +245 -0
- fusion_bench/method/pruning/wanda_utils/layerwrapper.py +61 -0
- fusion_bench/method/pruning/wanda_utils/prune.py +581 -0
- fusion_bench/method/pruning/wanda_utils/prune_opt.py +539 -0
- fusion_bench/method/pruning/wanda_utils/sparsegpt.py +165 -0
- fusion_bench/method/pwe_moe/__init__.py +5 -0
- fusion_bench/method/pwe_moe/clip_pwe_moe.py +315 -0
- fusion_bench/method/pwe_moe/module.py +316 -0
- fusion_bench/method/pwe_moe/phn/__init__.py +2 -0
- fusion_bench/method/pwe_moe/phn/solvers.py +195 -0
- fusion_bench/method/pwe_moe/utils.py +43 -0
- fusion_bench/method/rankone_moe/__init__.py +3 -0
- fusion_bench/method/rankone_moe/clip_rankone_moe.py +160 -0
- fusion_bench/method/rankone_moe/rankone_moe.py +249 -0
- fusion_bench/method/regmean/__init__.py +4 -0
- fusion_bench/method/regmean/clip_regmean.py +131 -0
- fusion_bench/method/regmean/gpt2_regmean.py +147 -0
- fusion_bench/method/regmean/regmean.py +375 -0
- fusion_bench/method/simple_average.py +112 -0
- fusion_bench/method/slerp/__init__.py +2 -0
- fusion_bench/method/slerp/slerp.py +101 -0
- fusion_bench/method/slerp/slerp_utils.py +107 -0
- fusion_bench/method/smile_upscaling/__init__.py +3 -0
- fusion_bench/method/smile_upscaling/singular_projection_merging.py +198 -0
- fusion_bench/method/smile_upscaling/smile_mistral_upscaling.py +331 -0
- fusion_bench/method/smile_upscaling/smile_upscaling.py +573 -0
- fusion_bench/method/sparse_we_moe/__init__.py +2 -0
- fusion_bench/method/sparse_we_moe/sparse_clip_we_moe.py +248 -0
- fusion_bench/method/sparse_we_moe/sparse_we_moe.py +301 -0
- fusion_bench/method/sparselo/__init__.py +2 -0
- fusion_bench/method/sparselo/sparselo.py +955 -0
- fusion_bench/method/surgery/__init__.py +1 -0
- fusion_bench/method/surgery/clip_layer_wise_adamerging_surgery.py +157 -0
- fusion_bench/method/tall_mask/__init__.py +0 -0
- fusion_bench/method/tall_mask/utils.py +234 -0
- fusion_bench/method/task_arithmetic/__init__.py +2 -0
- fusion_bench/method/task_arithmetic/task_arithmetic.py +151 -0
- fusion_bench/method/task_singular_vector/TSVC.py +16 -0
- fusion_bench/method/task_singular_vector/TSVM.py +63 -0
- fusion_bench/method/task_singular_vector/__init__.py +9 -0
- fusion_bench/method/task_singular_vector/utils/TSVC_utils.py +50 -0
- fusion_bench/method/task_singular_vector/utils/TSVM_utils.py +640 -0
- fusion_bench/method/task_singular_vector/utils/__init__.py +7 -0
- fusion_bench/method/ties_merging/__init__.py +2 -0
- fusion_bench/method/ties_merging/ties_merging.py +117 -0
- fusion_bench/method/ties_merging/ties_merging_utils.py +331 -0
- fusion_bench/method/trust_region/__init__.py +2 -0
- fusion_bench/method/trust_region/clip_task_arithmetic.py +205 -0
- fusion_bench/method/trust_region/utils.py +58 -0
- fusion_bench/method/we_moe/__init__.py +2 -0
- fusion_bench/method/we_moe/clip_we_moe.py +161 -0
- fusion_bench/method/we_moe/we_moe.py +247 -0
- fusion_bench/method/weighted_average/__init__.py +3 -0
- fusion_bench/method/weighted_average/llama.py +113 -0
- fusion_bench/method/weighted_average/weighted_average.py +102 -0
- fusion_bench/metrics/__init__.py +0 -0
- fusion_bench/metrics/continual_learning/backward_transfer.py +22 -0
- fusion_bench/metrics/nyuv2/__init__.py +11 -0
- fusion_bench/metrics/nyuv2/depth.py +45 -0
- fusion_bench/metrics/nyuv2/loss.py +31 -0
- fusion_bench/metrics/nyuv2/noise.py +16 -0
- fusion_bench/metrics/nyuv2/normal.py +48 -0
- fusion_bench/metrics/nyuv2/segmentation.py +43 -0
- fusion_bench/metrics/text_to_image_generation/__init__.py +9 -0
- fusion_bench/metrics/text_to_image_generation/aesthetic_scorer.py +123 -0
- fusion_bench/metrics/text_to_image_generation/compressibility.py +49 -0
- fusion_bench/metrics/text_to_image_generation/pickscore_scorer.py +95 -0
- fusion_bench/mixins/__init__.py +28 -0
- fusion_bench/mixins/clip_classification.py +252 -0
- fusion_bench/mixins/fabric_training.py +320 -0
- fusion_bench/mixins/lightning_fabric.py +174 -0
- fusion_bench/mixins/optim/__init__.py +0 -0
- fusion_bench/mixins/optim/adamw_with_warmup.py +42 -0
- fusion_bench/mixins/rich_live.py +21 -0
- fusion_bench/mixins/serialization.py +132 -0
- fusion_bench/mixins/simple_profiler.py +79 -0
- fusion_bench/modelpool/PeftModelForSeq2SeqLM.py +49 -0
- fusion_bench/modelpool/__init__.py +42 -0
- fusion_bench/modelpool/base_pool.py +268 -0
- fusion_bench/modelpool/causal_lm/__init__.py +2 -0
- fusion_bench/modelpool/causal_lm/causal_lm.py +139 -0
- fusion_bench/modelpool/clip_vision/__init__.py +1 -0
- fusion_bench/modelpool/clip_vision/modelpool.py +145 -0
- fusion_bench/modelpool/huggingface_automodel.py +20 -0
- fusion_bench/modelpool/huggingface_gpt2_classification.py +63 -0
- fusion_bench/modelpool/nyuv2_modelpool.py +40 -0
- fusion_bench/modelpool/seq2seq_lm/__init__.py +2 -0
- fusion_bench/modelpool/seq2seq_lm/modelpool.py +65 -0
- fusion_bench/modelpool/seq_classification_lm/__init__.py +2 -0
- fusion_bench/modelpool/seq_classification_lm/reward_model.py +15 -0
- fusion_bench/modelpool/seq_classification_lm/seq_classification_lm.py +98 -0
- fusion_bench/models/__init__.py +3 -0
- fusion_bench/models/chat_templates/__init__.py +1 -0
- fusion_bench/models/chat_templates/llama_3_Instruct.py +1 -0
- fusion_bench/models/chat_templates/load_tokenizer.py +43 -0
- fusion_bench/models/hf_clip.py +199 -0
- fusion_bench/models/linearized/__init__.py +0 -0
- fusion_bench/models/linearized/linearized_model_utils.py +91 -0
- fusion_bench/models/linearized/vision_model.py +122 -0
- fusion_bench/models/llama/__init__.py +16 -0
- fusion_bench/models/llama/model_utils/__init__.py +0 -0
- fusion_bench/models/llama/model_utils/embedding.py +87 -0
- fusion_bench/models/llama/model_utils/liger_kernel.py +86 -0
- fusion_bench/models/llama/model_utils/misc.py +112 -0
- fusion_bench/models/llama/model_utils/mod.py +52 -0
- fusion_bench/models/llama/model_utils/visual.py +241 -0
- fusion_bench/models/llama/patcher.py +78 -0
- fusion_bench/models/llama/tokenizer_loader.py +153 -0
- fusion_bench/models/masks/__init__.py +2 -0
- fusion_bench/models/masks/mask_model.py +160 -0
- fusion_bench/models/modeling_losparse_llama/__init__.py +4 -0
- fusion_bench/models/modeling_losparse_llama/configuration_losparse_llama.py +205 -0
- fusion_bench/models/modeling_losparse_llama/losparse_linear.py +67 -0
- fusion_bench/models/modeling_losparse_llama/modeling_losparse_llama.py +1825 -0
- fusion_bench/models/modeling_losparse_llama/register.py +8 -0
- fusion_bench/models/modeling_losparse_llama/utils.py +60 -0
- fusion_bench/models/modeling_smile_mistral/__init__.py +48 -0
- fusion_bench/models/modeling_smile_mistral/configuration_smile_mistral.py +21 -0
- fusion_bench/models/modeling_smile_mistral/modeling_smile_mistral.py +1034 -0
- fusion_bench/models/modeling_smile_mistral/register.py +8 -0
- fusion_bench/models/nyuv2/__init__.py +0 -0
- fusion_bench/models/nyuv2/aspp.py +82 -0
- fusion_bench/models/nyuv2/lightning_module.py +176 -0
- fusion_bench/models/nyuv2/resnet.py +405 -0
- fusion_bench/models/nyuv2/resnet_dilated.py +99 -0
- fusion_bench/models/parameter_dict.py +75 -0
- fusion_bench/models/rankone_moe.py +410 -0
- fusion_bench/models/separate_io.py +105 -0
- fusion_bench/models/smile_moe/__init__.py +0 -0
- fusion_bench/models/smile_moe/linear.py +256 -0
- fusion_bench/models/sparse_we_moe.py +459 -0
- fusion_bench/models/surgery/__init__.py +1 -0
- fusion_bench/models/surgery/surgerymodelwrapper.py +158 -0
- fusion_bench/models/utils.py +80 -0
- fusion_bench/models/we_moe.py +247 -0
- fusion_bench/models/wrappers/__init__.py +0 -0
- fusion_bench/models/wrappers/ensemble.py +183 -0
- fusion_bench/models/wrappers/layer_wise_fusion.py +336 -0
- fusion_bench/models/wrappers/task_wise_fusion.py +249 -0
- fusion_bench/optim/__init__.py +2 -0
- fusion_bench/optim/exception.py +47 -0
- fusion_bench/optim/lr_scheduler/__init__.py +1 -0
- fusion_bench/optim/lr_scheduler/linear_warmup.py +222 -0
- fusion_bench/optim/lr_scheduler/utils/__init__.py +1 -0
- fusion_bench/optim/lr_scheduler/utils/visualization.py +119 -0
- fusion_bench/optim/mezo.py +118 -0
- fusion_bench/programs/__init__.py +20 -0
- fusion_bench/programs/base_program.py +9 -0
- fusion_bench/programs/fabric_fusion_program.py +299 -0
- fusion_bench/scripts/__init__.py +0 -0
- fusion_bench/scripts/cli.py +43 -0
- fusion_bench/scripts/clip/__init__.py +0 -0
- fusion_bench/scripts/clip/convert_checkpoint.py +39 -0
- fusion_bench/scripts/imgui.py +218 -0
- fusion_bench/scripts/nyuv2_mtl_train.py +137 -0
- fusion_bench/scripts/webui.py +405 -0
- fusion_bench/taskpool/__init__.py +39 -0
- fusion_bench/taskpool/base_pool.py +35 -0
- fusion_bench/taskpool/clip_vision/__init__.py +4 -0
- fusion_bench/taskpool/clip_vision/clip_rankone_moe_taskpool.py +112 -0
- fusion_bench/taskpool/clip_vision/clip_sparse_wemoe_taskpool.py +120 -0
- fusion_bench/taskpool/clip_vision/taskpool.py +392 -0
- fusion_bench/taskpool/dummy.py +58 -0
- fusion_bench/taskpool/gpt2_text_classification.py +149 -0
- fusion_bench/taskpool/llama/__init__.py +1 -0
- fusion_bench/taskpool/llama/reward_model.py +157 -0
- fusion_bench/taskpool/llama/test_generation.py +185 -0
- fusion_bench/taskpool/nyuv2_taskpool.py +65 -0
- fusion_bench/tasks/__init__.py +2 -0
- fusion_bench/tasks/base_task.py +18 -0
- fusion_bench/tasks/classification.py +75 -0
- fusion_bench/tasks/clip_classification/__init__.py +183 -0
- fusion_bench/tasks/clip_classification/cifar10.py +33 -0
- fusion_bench/tasks/clip_classification/cifar100.py +146 -0
- fusion_bench/tasks/clip_classification/clip_dataset.py +1 -0
- fusion_bench/tasks/clip_classification/cub_200_2011.py +208 -0
- fusion_bench/tasks/clip_classification/dtd.py +60 -0
- fusion_bench/tasks/clip_classification/emnist_letters.py +31 -0
- fusion_bench/tasks/clip_classification/emnist_mnist.py +5 -0
- fusion_bench/tasks/clip_classification/eurosat.py +18 -0
- fusion_bench/tasks/clip_classification/fashion_mnist.py +18 -0
- fusion_bench/tasks/clip_classification/fer2013.py +18 -0
- fusion_bench/tasks/clip_classification/flower102.py +106 -0
- fusion_bench/tasks/clip_classification/food101.py +105 -0
- fusion_bench/tasks/clip_classification/gtsrb.py +51 -0
- fusion_bench/tasks/clip_classification/imagenet.py +2103 -0
- fusion_bench/tasks/clip_classification/kmnist.py +17 -0
- fusion_bench/tasks/clip_classification/mnist.py +5 -0
- fusion_bench/tasks/clip_classification/mongo_leaf_disease.py +19 -0
- fusion_bench/tasks/clip_classification/oxford_iiit_pet.py +41 -0
- fusion_bench/tasks/clip_classification/pcam.py +5 -0
- fusion_bench/tasks/clip_classification/rendered_sst2.py +3 -0
- fusion_bench/tasks/clip_classification/resisc45.py +68 -0
- fusion_bench/tasks/clip_classification/stanford_cars.py +209 -0
- fusion_bench/tasks/clip_classification/stl10.py +17 -0
- fusion_bench/tasks/clip_classification/sun397.py +404 -0
- fusion_bench/tasks/clip_classification/svhn.py +5 -0
- fusion_bench/tasks/clip_classification/tiny_imagenet.py +208 -0
- fusion_bench/tasks/flan_t5_text_generation/__init__.py +0 -0
- fusion_bench/tasks/flan_t5_text_generation/datasets_preprocess.py +71 -0
- fusion_bench/tasks/flan_t5_text_generation/glue_evaluation.py +132 -0
- fusion_bench/tasks/flan_t5_text_generation/glue_load_dataset.py +64 -0
- fusion_bench/tasks/flan_t5_text_generation/glue_preprocessors.py +379 -0
- fusion_bench/tasks/flan_t5_text_generation/glue_prompt_templates.py +52 -0
- fusion_bench/utils/__init__.py +14 -0
- fusion_bench/utils/auto.py +31 -0
- fusion_bench/utils/cache_utils.py +58 -0
- fusion_bench/utils/data.py +165 -0
- fusion_bench/utils/devices.py +231 -0
- fusion_bench/utils/dict.py +43 -0
- fusion_bench/utils/dtype.py +146 -0
- fusion_bench/utils/expr.py +90 -0
- fusion_bench/utils/fabric.py +17 -0
- fusion_bench/utils/functools.py +37 -0
- fusion_bench/utils/hydra_utils.py +28 -0
- fusion_bench/utils/instantiate.py +450 -0
- fusion_bench/utils/json.py +93 -0
- fusion_bench/utils/lazy_imports.py +74 -0
- fusion_bench/utils/misc.py +18 -0
- fusion_bench/utils/packages.py +84 -0
- fusion_bench/utils/parameters.py +323 -0
- fusion_bench/utils/path.py +22 -0
- fusion_bench/utils/plot/__init__.py +0 -0
- fusion_bench/utils/plot/color_data.py +1726 -0
- fusion_bench/utils/plot/token.py +52 -0
- fusion_bench/utils/plot/token_notebook.py +127 -0
- fusion_bench/utils/pylogger.py +55 -0
- fusion_bench/utils/rich_utils.py +201 -0
- fusion_bench/utils/set.py +8 -0
- fusion_bench/utils/state_dict_arithmetic.py +297 -0
- fusion_bench/utils/strenum/__init__.py +326 -0
- fusion_bench/utils/strenum/_name_mangler.py +127 -0
- fusion_bench/utils/strenum/_version.py +556 -0
- fusion_bench/utils/tensorboard.py +51 -0
- fusion_bench/utils/timer.py +49 -0
- fusion_bench/utils/type.py +34 -0
- fusion_bench-0.2.9.dist-info/LICENSE +21 -0
- fusion_bench-0.2.9.dist-info/METADATA +258 -0
- fusion_bench-0.2.9.dist-info/RECORD +727 -0
- fusion_bench-0.2.9.dist-info/WHEEL +5 -0
- fusion_bench-0.2.9.dist-info/entry_points.txt +3 -0
- fusion_bench-0.2.9.dist-info/top_level.txt +1 -0
- fusion_bench_config/README.md +12 -0
- fusion_bench_config/clip-vit-base-patch32_robustness_corrupted.yaml +23 -0
- fusion_bench_config/dataset/image_classification/README.md +6 -0
- fusion_bench_config/dataset/image_classification/test/TALL14.yaml +20 -0
- fusion_bench_config/dataset/image_classification/test/TALL20.yaml +28 -0
- fusion_bench_config/dataset/image_classification/test/cifar10.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/cifar100.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/cub-200-2011.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/dtd.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/emnist_letters.yaml +5 -0
- fusion_bench_config/dataset/image_classification/test/emnist_mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/eurosat.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/fashion_mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/fer2013.yaml +3 -0
- fusion_bench_config/dataset/image_classification/test/food101.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/gtsrb.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/kmnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/mango-leaf-disease.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/oxford-iiit-pet.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/oxford_flowers102.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/pcam.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/rendered-sst2.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/resisc45.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/stanford-cars.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/stl10.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/sun397.yaml +4 -0
- fusion_bench_config/dataset/image_classification/test/svhn.yaml +6 -0
- fusion_bench_config/dataset/image_classification/test/the_eight_tasks.yaml +9 -0
- fusion_bench_config/dataset/image_classification/test/tiny-imagenet.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/TALL14.yaml +20 -0
- fusion_bench_config/dataset/image_classification/train/TALL20.yaml +28 -0
- fusion_bench_config/dataset/image_classification/train/cifar10.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/cifar100.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/cub-200-2011.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/dtd.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/emnist_letters.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/emnist_mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/eurosat.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/fashion_mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/fer2013.yaml +3 -0
- fusion_bench_config/dataset/image_classification/train/food101.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/gtsrb.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/kmnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/mango-leaf-disease.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/mnist.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/oxford-iiit-pet.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/oxford_flowers102.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/pcam.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/rendered-sst2.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/resisc45.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/stanford-cars.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/stl10.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/sun397.yaml +4 -0
- fusion_bench_config/dataset/image_classification/train/svhn.yaml +6 -0
- fusion_bench_config/dataset/image_classification/train/the_eight_tasks.yaml +9 -0
- fusion_bench_config/dataset/image_classification/train/tiny-imagenet.yaml +4 -0
- fusion_bench_config/dataset/image_classification/val/dtd.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/eurosat.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/gtsrb.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/mnist.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/resisc45.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/stanford-cars.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/sun397.yaml +10 -0
- fusion_bench_config/dataset/image_classification/val/svhn.yaml +12 -0
- fusion_bench_config/dataset/image_classification/val/the_eight_tasks.yaml +9 -0
- fusion_bench_config/dataset/llm_sft/alpaca_cleaned.yaml +6 -0
- fusion_bench_config/dataset/llm_sft/ultrachat_200k.yaml +3 -0
- fusion_bench_config/dataset/question_answering/search_qa.yaml +6 -0
- fusion_bench_config/dataset/question_answering/test/search_qa.yaml +7 -0
- fusion_bench_config/dataset/question_answering/train/MetaMathQA.yaml +4 -0
- fusion_bench_config/dataset/question_answering/train/search_qa.yaml +7 -0
- fusion_bench_config/dataset/question_answering/val/search_qa.yaml +7 -0
- fusion_bench_config/dataset/summarization/test/xsum.yaml +4 -0
- fusion_bench_config/dataset/summarization/train/xsum.yaml +4 -0
- fusion_bench_config/dataset/summarization/val/xsum.yaml +4 -0
- fusion_bench_config/dataset/summarization/xsum.yaml +3 -0
- fusion_bench_config/dataset/text_generation/test/gsm-hard.yaml +4 -0
- fusion_bench_config/dataset/text_generation/test/gsm8k.yaml +5 -0
- fusion_bench_config/dataset/text_generation/test/gsm8k_question_label.yaml +3 -0
- fusion_bench_config/dataset/text_generation/train/CodeAlpaca-20k.yaml +4 -0
- fusion_bench_config/dataset/text_generation/train/gsm8k.yaml +5 -0
- fusion_bench_config/dataset/text_generation/train/gsm8k_question_label.yaml +3 -0
- fusion_bench_config/fabric/auto.yaml +16 -0
- fusion_bench_config/fabric/llama_ddp.yaml +18 -0
- fusion_bench_config/fabric/llama_fsdp.yaml +16 -0
- fusion_bench_config/fabric/llama_peft_fsdp.yaml +16 -0
- fusion_bench_config/fabric/loggers/csv_logger.yaml +11 -0
- fusion_bench_config/fabric/loggers/tensorboard_logger.yaml +11 -0
- fusion_bench_config/fabric/loggers/wandb_logger.yaml +2 -0
- fusion_bench_config/fabric/strategy/deepspeed.yaml +10 -0
- fusion_bench_config/fabric/strategy/llama_fsdp.yaml +8 -0
- fusion_bench_config/fabric/strategy/llama_peft_fsdp.yaml +9 -0
- fusion_bench_config/fabric_model_fusion.yaml +20 -0
- fusion_bench_config/hydra/default.yaml +8 -0
- fusion_bench_config/hydra/help/fusion_bench_help.yaml +47 -0
- fusion_bench_config/hydra/job_logging/rich_logging.yaml +20 -0
- fusion_bench_config/llama_full_finetune.yaml +19 -0
- fusion_bench_config/llama_magnitude_pruning.yaml +16 -0
- fusion_bench_config/llama_model_fusion.yaml +17 -0
- fusion_bench_config/method/ada_svd/clip_vision.yaml +9 -0
- fusion_bench_config/method/adamerging/clip.yaml +23 -0
- fusion_bench_config/method/adamerging/layer_wise_flan_t5.yaml +23 -0
- fusion_bench_config/method/adamerging/layer_wise_gpt2.yaml +23 -0
- fusion_bench_config/method/adamerging/llama_sft.yaml +33 -0
- fusion_bench_config/method/adamerging.yaml +23 -0
- fusion_bench_config/method/analysis/task_vector_cos_similarity.yaml +6 -0
- fusion_bench_config/method/analysis/task_vector_violin_plot.yaml +6 -0
- fusion_bench_config/method/classification/clip_continual_finetune.yaml +28 -0
- fusion_bench_config/method/classification/clip_finetune.yaml +26 -0
- fusion_bench_config/method/clip_finetune.yaml +26 -0
- fusion_bench_config/method/concrete_subspace/clip_concrete_layer_wise_adamerging.yaml +27 -0
- fusion_bench_config/method/concrete_subspace/clip_concrete_task_arithmetic.yaml +25 -0
- fusion_bench_config/method/concrete_subspace/clip_concrete_task_wise_adamerging.yaml +27 -0
- fusion_bench_config/method/dare/simple_average.yaml +5 -0
- fusion_bench_config/method/dare/task_arithmetic.yaml +6 -0
- fusion_bench_config/method/dare/ties_merging.yaml +15 -0
- fusion_bench_config/method/dawe/dawe_for_clip.yaml +32 -0
- fusion_bench_config/method/depth_upscaling.yaml +5 -0
- fusion_bench_config/method/dummy.yaml +1 -0
- fusion_bench_config/method/ensemble/max_model_predictor.yaml +1 -0
- fusion_bench_config/method/ensemble/simple_ensemble.yaml +2 -0
- fusion_bench_config/method/ensemble/weighted_ensemble.yaml +6 -0
- fusion_bench_config/method/fisher_merging/clip_fisher_merging.yaml +13 -0
- fusion_bench_config/method/fisher_merging/fisher_merging.yaml +9 -0
- fusion_bench_config/method/fisher_merging/gpt2_fisher_merging.yaml +12 -0
- fusion_bench_config/method/linear/expo.yaml +8 -0
- fusion_bench_config/method/linear/linear_interpolation.yaml +3 -0
- fusion_bench_config/method/linear/llama_expo.yaml +19 -0
- fusion_bench_config/method/linear/llama_expo_with_dare.yaml +19 -0
- fusion_bench_config/method/linear/simple_average_for_llama.yaml +5 -0
- fusion_bench_config/method/linear/task_arithmetic_for_llama.yaml +4 -0
- fusion_bench_config/method/linear/weighted_average.yaml +6 -0
- fusion_bench_config/method/linear/weighted_average_for_llama.yaml +12 -0
- fusion_bench_config/method/lm_finetune/bradley_terry_rm.yaml +47 -0
- fusion_bench_config/method/lm_finetune/fullfinetune_sft.yaml +47 -0
- fusion_bench_config/method/lm_finetune/peftfinetune_sft.yaml +63 -0
- fusion_bench_config/method/mixtral_moe_merging.yaml +4 -0
- fusion_bench_config/method/mixtral_moe_upscaling.yaml +7 -0
- fusion_bench_config/method/model_recombination.yaml +4 -0
- fusion_bench_config/method/opcm/opcm.yaml +12 -0
- fusion_bench_config/method/opcm/task_arithmetic.yaml +12 -0
- fusion_bench_config/method/opcm/ties_merging.yaml +18 -0
- fusion_bench_config/method/opcm/weight_average.yaml +10 -0
- fusion_bench_config/method/pruning/llama_magnitude_pruning.yaml +14 -0
- fusion_bench_config/method/pruning/llama_random_pruning.yaml +9 -0
- fusion_bench_config/method/pruning/llama_wanda_pruning.yaml +16 -0
- fusion_bench_config/method/pruning/magnitude_diff_pruning.yaml +5 -0
- fusion_bench_config/method/pwe_moe_ls_for_clip.yaml +22 -0
- fusion_bench_config/method/rankone_moe/rankone_moe.yaml +26 -0
- fusion_bench_config/method/regmean/clip_regmean.yaml +11 -0
- fusion_bench_config/method/regmean/gpt2_regmean.yaml +12 -0
- fusion_bench_config/method/regmean/regmean.yaml +4 -0
- fusion_bench_config/method/simple_average.yaml +1 -0
- fusion_bench_config/method/slerp/slerp.yaml +6 -0
- fusion_bench_config/method/smile_upscaling/singular_projection_merging.yaml +8 -0
- fusion_bench_config/method/smile_upscaling/smile_mistral_upscaling.yaml +10 -0
- fusion_bench_config/method/smile_upscaling/smile_upscaling.yaml +14 -0
- fusion_bench_config/method/sparselo_pruning/llama_iterative_sparselo.yaml +20 -0
- fusion_bench_config/method/sparselo_pruning/llama_pcp_sparselo.yaml +20 -0
- fusion_bench_config/method/sparselo_pruning/llama_sparselo.yaml +19 -0
- fusion_bench_config/method/surgery/adamerging_surgery.yaml +27 -0
- fusion_bench_config/method/task_arithmetic.yaml +2 -0
- fusion_bench_config/method/task_singular_vector/TaskSingularVectorMerging.yaml +2 -0
- fusion_bench_config/method/ties_merging.yaml +8 -0
- fusion_bench_config/method/trust_region/clip_task_arithmetic.yaml +7 -0
- fusion_bench_config/method/wemoe/sparse_weight_ensembling_moe.yaml +39 -0
- fusion_bench_config/method/wemoe/weight_ensembling_moe.yaml +20 -0
- fusion_bench_config/model/clip-vit/README.md +38 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_TALL14.yaml +22 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_TALL20.yaml +29 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_cifar10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_cifar100.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_dtd.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_eight_tasks.yaml +10 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_emnist_letters.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_eurosat.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_fashion_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_fer2013.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_food101.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_gtsrb.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_kmnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_oxford-iiit-pet.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_oxford_flowers102.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_pcam.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_rendered-sst2.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_resisc45.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_stanford-cars.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_stl10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_sun397.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch16_svhn.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_TALL14.yaml +22 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_TALL20.yaml +29 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_cifar10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_cifar100.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_dtd.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_eight_tasks.yaml +11 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_emnist_letters.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_eurosat.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_fashion_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_fer2013.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_food101.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_gtsrb.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_kmnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_oxford-iiit-pet.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_oxford_flowers102.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_pcam.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_rendered-sst2.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_resisc45.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_stanford-cars.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_stl10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_sun397.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-base-patch32_svhn.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_TALL14.yaml +22 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_TALL20.yaml +29 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_cifar10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_cifar100.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_dtd.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_eight_tasks.yaml +10 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_emnist_letters.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_eurosat.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_fashion_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_fer2013.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_food101.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_gtsrb.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_kmnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_mnist.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_oxford-iiit-pet.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_oxford_flowers102.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_pcam.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_rendered-sst2.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_resisc45.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_stanford-cars.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_stl10.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_sun397.yaml +1 -0
- fusion_bench_config/model/clip-vit/clip-vit-large-patch14_svhn.yaml +1 -0
- fusion_bench_config/model/clip-vit/download_TALL20_models.sh +6 -0
- fusion_bench_config/model/clip-vit/generate_vit_model_config.sh +23 -0
- fusion_bench_config/model/flan-t5/flan-t5-base.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-cola.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-cola_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-mnli.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-mnli_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-mrpc.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-mrpc_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-qnli.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-qnli_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-qqp.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-qqp_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-rte.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-rte_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-sst2.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-sst2_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-stsb.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-base_glue-stsb_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large.yaml +3 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-cola_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-mnli_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-mrpc_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-qnli_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-qqp_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-rte_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-sst2_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/flan-t5-large_glue-stsb_lora-16.yaml +4 -0
- fusion_bench_config/model/flan-t5/generate_flan-t5.sh +38 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/_template.yaml +12 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TA8.yaml +8 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TA8_lora.yaml +53 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TA8_model_only.yaml +6 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TALL14.yaml +11 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TALL14_model_only.yaml +9 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TALL20.yaml +11 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_TALL20_model_only.yaml +9 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_individual.yaml +19 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch16_individual_lora.yaml +14 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TA8.yaml +5 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TA8_control_task.yaml +24 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TA8_model_only.yaml +3 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TALL14.yaml +8 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TALL14_model_only.yaml +6 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TALL20.yaml +8 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_TALL20_model_only.yaml +6 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_generalization_exp1.yaml +24 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_generalization_exp2.yaml +24 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_individual.yaml +13 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_mtl.yaml +5 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_robustness_clean.yaml +18 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_robustness_corrupted.yaml +29 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_single_finetuned.yaml +5 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_single_task_projection.yaml +15 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_svhn_and_mnist.yaml +6 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-base-patch32_two_tasks_control_task.yaml +18 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TA8.yaml +8 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TA8_model_only.yaml +6 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TALL14.yaml +11 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TALL14_model_only.yaml +9 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TALL20.yaml +11 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_TALL20_model_only.yaml +9 -0
- fusion_bench_config/modelpool/CLIPVisionModelPool/clip-vit-large-patch14_individual.yaml +19 -0
- fusion_bench_config/modelpool/CausalLMPool/llama_alpaca_cleaned.yaml +21 -0
- fusion_bench_config/modelpool/CausalLMPool/llama_codealpaca.yaml +21 -0
- fusion_bench_config/modelpool/CausalLMPool/llama_for_causallm.yaml +20 -0
- fusion_bench_config/modelpool/CausalLMPool/llama_metamathqa.yaml +19 -0
- fusion_bench_config/modelpool/CausalLMPool/llama_ultrachat.yaml +18 -0
- fusion_bench_config/modelpool/CausalLMPool/simle_mixtral_exp_v4.yaml +21 -0
- fusion_bench_config/modelpool/CausalLMPool/single_llama_model.yaml +17 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/_template.yaml +8 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_glue.yaml +13 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_glue_lora16.yaml +41 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_glue_lora16_tta.yaml +68 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-base_individual.yaml +7 -0
- fusion_bench_config/modelpool/Seq2SeqLMPool/flan-t5-large_glue_lora16.yaml +45 -0
- fusion_bench_config/modelpool/SeqenceClassificationModelPool/llama_preference700k.yaml +23 -0
- fusion_bench_config/modelpool/SeqenceClassificationModelPool/single_reward_model.yaml +14 -0
- fusion_bench_config/modelpool/automodelpool.yaml +12 -0
- fusion_bench_config/modelpool/gpt-2_glue.yaml +64 -0
- fusion_bench_config/modelpool/mixtral_moe_merging.yaml +14 -0
- fusion_bench_config/modelpool/mixtral_moe_upscaling.yaml +6 -0
- fusion_bench_config/modelpool/nyuv2_modelpool.yaml +26 -0
- fusion_bench_config/modelpool/smile_mistral_exp_v1.yaml +9 -0
- fusion_bench_config/modelpool/smile_mistral_exp_v2.yaml +9 -0
- fusion_bench_config/modelpool/smile_mistral_exp_v3.yaml +9 -0
- fusion_bench_config/modelpool/smile_mistral_exp_v4.yaml +13 -0
- fusion_bench_config/nyuv2_config.yaml +17 -0
- fusion_bench_config/nyuv2_mtl_train.yaml +32 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/_template.yaml +31 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-base-patch32_robustness_corrupted.yaml +27 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TA8.yaml +11 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TA8_B16.yaml +31 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TA8_L14.yaml +12 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TA8_val.yaml +12 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TA8_with_control_task.yaml +12 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TALL14.yaml +19 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-classification_TALL20.yaml +26 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_cifar10.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_cifar100.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_dtd.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_emnist_letters.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_eurosat.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_fashion_mnist.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_fer2013.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_food101.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_gtsrb.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_kmnist.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_mnist.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_oxford-iiit-pet.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_oxford_flowers102.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_oxford_flowers102_val.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_pcam.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_rendered-sst2.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_resisc45.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_stanford-cars.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_stl10.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_sun397.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip-vit-single-task_svhn.yaml +3 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip_rankone_wemoe_clip-vit-classification_TA8.yaml +18 -0
- fusion_bench_config/taskpool/CLIPVisionModelTaskPool/clip_sparse_wemoe_clip-vit-classification_TA8.yaml +18 -0
- fusion_bench_config/taskpool/clip-vit-base-patch32_robustness_clean.yaml +24 -0
- fusion_bench_config/taskpool/clip-vit-base-patch32_robustness_corrupted.yaml +27 -0
- fusion_bench_config/taskpool/clip-vit-base-patch32_svhn_and_mnist.yaml +22 -0
- fusion_bench_config/taskpool/dummy.yaml +2 -0
- fusion_bench_config/taskpool/flan-t5_glue_text_generation.yaml +44 -0
- fusion_bench_config/taskpool/gpt-2_glue.yaml +39 -0
- fusion_bench_config/taskpool/nyuv2_taskpool.yaml +9 -0
- fusion_bench_config/taskpool/reward_model_evaluation.yaml +18 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# pylint: disable=no-name-in-module
|
|
2
|
+
import re
|
|
3
|
+
from zlib import crc32
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class _NameMangler:
|
|
7
|
+
_regex = re.compile(r"([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))")
|
|
8
|
+
|
|
9
|
+
def words(self, name):
|
|
10
|
+
"""
|
|
11
|
+
Split a string into words. Should correctly handle splitting:
|
|
12
|
+
camelCase
|
|
13
|
+
PascalCase
|
|
14
|
+
kebab-case
|
|
15
|
+
snake_case
|
|
16
|
+
MACRO_CASE
|
|
17
|
+
camel_Snake_Case
|
|
18
|
+
Pascal_Snake_Case
|
|
19
|
+
COBOL-CASE
|
|
20
|
+
Http-Header-Case
|
|
21
|
+
|
|
22
|
+
It _does not_ handle splitting spongebob case.
|
|
23
|
+
"""
|
|
24
|
+
yield from (m.group(0) for m in self._regex.finditer(name))
|
|
25
|
+
|
|
26
|
+
def camel(self, name):
|
|
27
|
+
"""
|
|
28
|
+
Convert a name to camelCase
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def cased_words(word_iter):
|
|
32
|
+
yield next(word_iter, "").lower()
|
|
33
|
+
yield from (w.title() for w in word_iter)
|
|
34
|
+
|
|
35
|
+
return "".join(cased_words(self.words(name)))
|
|
36
|
+
|
|
37
|
+
def pascal(self, name):
|
|
38
|
+
"""
|
|
39
|
+
Convert a name to PascalCase
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
return "".join(w.title() for w in self.words(name))
|
|
43
|
+
|
|
44
|
+
def kebab(self, name):
|
|
45
|
+
"""
|
|
46
|
+
Convert a name to kebab-case
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
return "-".join(w.lower() for w in self.words(name))
|
|
50
|
+
|
|
51
|
+
def snake(self, name):
|
|
52
|
+
"""
|
|
53
|
+
Convert a name to snake_case
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
return "_".join(w.lower() for w in self.words(name))
|
|
57
|
+
|
|
58
|
+
def macro(self, name):
|
|
59
|
+
"""
|
|
60
|
+
Convert a name to MACRO_CASE
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
return "_".join(w.upper() for w in self.words(name))
|
|
64
|
+
|
|
65
|
+
# The following are inspired by examples in the Wikipedia
|
|
66
|
+
# [Naming convention](https://en.wikipedia.org/wiki/Naming_convention_(programming))
|
|
67
|
+
# article
|
|
68
|
+
|
|
69
|
+
def camel_snake(self, name):
|
|
70
|
+
"""
|
|
71
|
+
Convert a name to camel_Snake_Case
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
def cased_words(word_iter):
|
|
75
|
+
yield next(word_iter, "").lower()
|
|
76
|
+
yield from (w.title() for w in word_iter)
|
|
77
|
+
|
|
78
|
+
return "_".join(cased_words(self.words(name)))
|
|
79
|
+
|
|
80
|
+
def pascal_snake(self, name):
|
|
81
|
+
"""
|
|
82
|
+
Convert a name to Pascal_Snake_Case
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
return "_".join(w.title() for w in self.words(name))
|
|
86
|
+
|
|
87
|
+
def spongebob(self, name):
|
|
88
|
+
"""
|
|
89
|
+
Convert a name to SpOngEBOb_CASe
|
|
90
|
+
|
|
91
|
+
The PRNG we use is seeded with the word to be scrambled. This produces
|
|
92
|
+
stable output so the same input will always produce in the same output.
|
|
93
|
+
It's not `truly` random, but your tests will thank me.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
def prng(seed_word):
|
|
97
|
+
state = 1 << 31 | crc32(seed_word.encode("utf-8")) | 1
|
|
98
|
+
|
|
99
|
+
def step(state):
|
|
100
|
+
state = state >> 1 | (state & 0x01 ^ ((state & 0x02) >> 1)) << 31
|
|
101
|
+
bit = state & 0x1
|
|
102
|
+
return bit, state
|
|
103
|
+
|
|
104
|
+
for _ in range(100):
|
|
105
|
+
_, state = step(state)
|
|
106
|
+
while True:
|
|
107
|
+
bit, state = step(state)
|
|
108
|
+
yield str.upper if bit else str.lower
|
|
109
|
+
|
|
110
|
+
def scramble(word):
|
|
111
|
+
return "".join(f(ch) for ch, f in zip(word, prng(word)))
|
|
112
|
+
|
|
113
|
+
return "_".join(scramble(w) for w in self.words(name))
|
|
114
|
+
|
|
115
|
+
def cobol(self, name):
|
|
116
|
+
"""
|
|
117
|
+
Convert a name to COBOL-CASE
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
return "-".join(w.upper() for w in self.words(name))
|
|
121
|
+
|
|
122
|
+
def http_header(self, name):
|
|
123
|
+
"""
|
|
124
|
+
Convert a name to Http-Header-Case
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
return "-".join(w.title() for w in self.words(name))
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
# This file helps to compute a version number in source trees obtained from
|
|
2
|
+
# git-archive tarball (such as those provided by githubs download-from-tag
|
|
3
|
+
# feature). Distribution tarballs (built by setup.py sdist) and build
|
|
4
|
+
# directories (produced by setup.py build) will contain a much shorter file
|
|
5
|
+
# that just contains the computed version number.
|
|
6
|
+
|
|
7
|
+
# This file is released into the public domain. Generated by
|
|
8
|
+
# versioneer-0.18 (https://github.com/warner/python-versioneer)
|
|
9
|
+
|
|
10
|
+
"""Git implementation of _version.py."""
|
|
11
|
+
|
|
12
|
+
import errno
|
|
13
|
+
import os
|
|
14
|
+
import re
|
|
15
|
+
import subprocess
|
|
16
|
+
import sys
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_keywords():
|
|
20
|
+
"""Get the keywords needed to look up the version information."""
|
|
21
|
+
# these strings will be replaced by git during git-archive.
|
|
22
|
+
# setup.py/versioneer.py will grep for the variable names, so they must
|
|
23
|
+
# each be defined on a line of their own. _version.py will just call
|
|
24
|
+
# get_keywords().
|
|
25
|
+
git_refnames = "$Format:%d$"
|
|
26
|
+
git_full = "$Format:%H$"
|
|
27
|
+
git_date = "$Format:%ci$"
|
|
28
|
+
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
|
|
29
|
+
return keywords
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class VersioneerConfig:
|
|
33
|
+
"""Container for Versioneer configuration parameters."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_config():
|
|
37
|
+
"""Create, populate and return the VersioneerConfig() object."""
|
|
38
|
+
# these strings are filled in when 'setup.py versioneer' creates
|
|
39
|
+
# _version.py
|
|
40
|
+
cfg = VersioneerConfig()
|
|
41
|
+
cfg.VCS = "git"
|
|
42
|
+
cfg.style = "pep440"
|
|
43
|
+
cfg.tag_prefix = "v"
|
|
44
|
+
cfg.parentdir_prefix = "v"
|
|
45
|
+
cfg.versionfile_source = "strenum/_version.py"
|
|
46
|
+
cfg.verbose = False
|
|
47
|
+
return cfg
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class NotThisMethod(Exception):
|
|
51
|
+
"""Exception raised if a method is not valid for the current scenario."""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
LONG_VERSION_PY = {}
|
|
55
|
+
HANDLERS = {}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def register_vcs_handler(vcs, method): # decorator
|
|
59
|
+
"""Decorator to mark a method as the handler for a particular VCS."""
|
|
60
|
+
|
|
61
|
+
def decorate(f):
|
|
62
|
+
"""Store f in HANDLERS[vcs][method]."""
|
|
63
|
+
if vcs not in HANDLERS:
|
|
64
|
+
HANDLERS[vcs] = {}
|
|
65
|
+
HANDLERS[vcs][method] = f
|
|
66
|
+
return f
|
|
67
|
+
|
|
68
|
+
return decorate
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None):
|
|
72
|
+
"""Call the given command(s)."""
|
|
73
|
+
assert isinstance(commands, list)
|
|
74
|
+
p = None
|
|
75
|
+
for c in commands:
|
|
76
|
+
try:
|
|
77
|
+
dispcmd = str([c] + args)
|
|
78
|
+
# remember shell=False, so use git.cmd on windows, not just git
|
|
79
|
+
p = subprocess.Popen(
|
|
80
|
+
[c] + args,
|
|
81
|
+
cwd=cwd,
|
|
82
|
+
env=env,
|
|
83
|
+
stdout=subprocess.PIPE,
|
|
84
|
+
stderr=(subprocess.PIPE if hide_stderr else None),
|
|
85
|
+
)
|
|
86
|
+
break
|
|
87
|
+
except EnvironmentError:
|
|
88
|
+
e = sys.exc_info()[1]
|
|
89
|
+
if e.errno == errno.ENOENT:
|
|
90
|
+
continue
|
|
91
|
+
if verbose:
|
|
92
|
+
print("unable to run %s" % dispcmd)
|
|
93
|
+
print(e)
|
|
94
|
+
return None, None
|
|
95
|
+
else:
|
|
96
|
+
if verbose:
|
|
97
|
+
print("unable to find command, tried %s" % (commands,))
|
|
98
|
+
return None, None
|
|
99
|
+
stdout = p.communicate()[0].strip()
|
|
100
|
+
if sys.version_info[0] >= 3:
|
|
101
|
+
stdout = stdout.decode()
|
|
102
|
+
if p.returncode != 0:
|
|
103
|
+
if verbose:
|
|
104
|
+
print("unable to run %s (error)" % dispcmd)
|
|
105
|
+
print("stdout was %s" % stdout)
|
|
106
|
+
return None, p.returncode
|
|
107
|
+
return stdout, p.returncode
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def versions_from_parentdir(parentdir_prefix, root, verbose):
|
|
111
|
+
"""Try to determine the version from the parent directory name.
|
|
112
|
+
|
|
113
|
+
Source tarballs conventionally unpack into a directory that includes both
|
|
114
|
+
the project name and a version string. We will also support searching up
|
|
115
|
+
two directory levels for an appropriately named parent directory
|
|
116
|
+
"""
|
|
117
|
+
rootdirs = []
|
|
118
|
+
|
|
119
|
+
for i in range(3):
|
|
120
|
+
dirname = os.path.basename(root)
|
|
121
|
+
if dirname.startswith(parentdir_prefix):
|
|
122
|
+
return {
|
|
123
|
+
"version": dirname[len(parentdir_prefix) :],
|
|
124
|
+
"full-revisionid": None,
|
|
125
|
+
"dirty": False,
|
|
126
|
+
"error": None,
|
|
127
|
+
"date": None,
|
|
128
|
+
}
|
|
129
|
+
else:
|
|
130
|
+
rootdirs.append(root)
|
|
131
|
+
root = os.path.dirname(root) # up a level
|
|
132
|
+
|
|
133
|
+
if verbose:
|
|
134
|
+
print(
|
|
135
|
+
"Tried directories %s but none started with prefix %s"
|
|
136
|
+
% (str(rootdirs), parentdir_prefix)
|
|
137
|
+
)
|
|
138
|
+
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@register_vcs_handler("git", "get_keywords")
|
|
142
|
+
def git_get_keywords(versionfile_abs):
|
|
143
|
+
"""Extract version information from the given file."""
|
|
144
|
+
# the code embedded in _version.py can just fetch the value of these
|
|
145
|
+
# keywords. When used from setup.py, we don't want to import _version.py,
|
|
146
|
+
# so we do it with a regexp instead. This function is not used from
|
|
147
|
+
# _version.py.
|
|
148
|
+
keywords = {}
|
|
149
|
+
try:
|
|
150
|
+
f = open(versionfile_abs, "r")
|
|
151
|
+
for line in f.readlines():
|
|
152
|
+
if line.strip().startswith("git_refnames ="):
|
|
153
|
+
mo = re.search(r'=\s*"(.*)"', line)
|
|
154
|
+
if mo:
|
|
155
|
+
keywords["refnames"] = mo.group(1)
|
|
156
|
+
if line.strip().startswith("git_full ="):
|
|
157
|
+
mo = re.search(r'=\s*"(.*)"', line)
|
|
158
|
+
if mo:
|
|
159
|
+
keywords["full"] = mo.group(1)
|
|
160
|
+
if line.strip().startswith("git_date ="):
|
|
161
|
+
mo = re.search(r'=\s*"(.*)"', line)
|
|
162
|
+
if mo:
|
|
163
|
+
keywords["date"] = mo.group(1)
|
|
164
|
+
f.close()
|
|
165
|
+
except EnvironmentError:
|
|
166
|
+
pass
|
|
167
|
+
return keywords
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@register_vcs_handler("git", "keywords")
|
|
171
|
+
def git_versions_from_keywords(keywords, tag_prefix, verbose):
|
|
172
|
+
"""Get version information from git keywords."""
|
|
173
|
+
if not keywords:
|
|
174
|
+
raise NotThisMethod("no keywords at all, weird")
|
|
175
|
+
date = keywords.get("date")
|
|
176
|
+
if date is not None:
|
|
177
|
+
# git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
|
|
178
|
+
# datestamp. However we prefer "%ci" (which expands to an "ISO-8601
|
|
179
|
+
# -like" string, which we must then edit to make compliant), because
|
|
180
|
+
# it's been around since git-1.5.3, and it's too difficult to
|
|
181
|
+
# discover which version we're using, or to work around using an
|
|
182
|
+
# older one.
|
|
183
|
+
date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
|
|
184
|
+
refnames = keywords["refnames"].strip()
|
|
185
|
+
if refnames.startswith("$Format"):
|
|
186
|
+
if verbose:
|
|
187
|
+
print("keywords are unexpanded, not using")
|
|
188
|
+
raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
|
|
189
|
+
refs = set([r.strip() for r in refnames.strip("()").split(",")])
|
|
190
|
+
# starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
|
|
191
|
+
# just "foo-1.0". If we see a "tag: " prefix, prefer those.
|
|
192
|
+
TAG = "tag: "
|
|
193
|
+
tags = set([r[len(TAG) :] for r in refs if r.startswith(TAG)])
|
|
194
|
+
if not tags:
|
|
195
|
+
# Either we're using git < 1.8.3, or there really are no tags. We use
|
|
196
|
+
# a heuristic: assume all version tags have a digit. The old git %d
|
|
197
|
+
# expansion behaves like git log --decorate=short and strips out the
|
|
198
|
+
# refs/heads/ and refs/tags/ prefixes that would let us distinguish
|
|
199
|
+
# between branches and tags. By ignoring refnames without digits, we
|
|
200
|
+
# filter out many common branch names like "release" and
|
|
201
|
+
# "stabilization", as well as "HEAD" and "master".
|
|
202
|
+
tags = set([r for r in refs if re.search(r"\d", r)])
|
|
203
|
+
if verbose:
|
|
204
|
+
print("discarding '%s', no digits" % ",".join(refs - tags))
|
|
205
|
+
if verbose:
|
|
206
|
+
print("likely tags: %s" % ",".join(sorted(tags)))
|
|
207
|
+
for ref in sorted(tags):
|
|
208
|
+
# sorting will prefer e.g. "2.0" over "2.0rc1"
|
|
209
|
+
if ref.startswith(tag_prefix):
|
|
210
|
+
r = ref[len(tag_prefix) :]
|
|
211
|
+
if verbose:
|
|
212
|
+
print("picking %s" % r)
|
|
213
|
+
return {
|
|
214
|
+
"version": r,
|
|
215
|
+
"full-revisionid": keywords["full"].strip(),
|
|
216
|
+
"dirty": False,
|
|
217
|
+
"error": None,
|
|
218
|
+
"date": date,
|
|
219
|
+
}
|
|
220
|
+
# no suitable tags, so version is "0+unknown", but full hex is still there
|
|
221
|
+
if verbose:
|
|
222
|
+
print("no suitable tags, using unknown + full revision id")
|
|
223
|
+
return {
|
|
224
|
+
"version": "0+unknown",
|
|
225
|
+
"full-revisionid": keywords["full"].strip(),
|
|
226
|
+
"dirty": False,
|
|
227
|
+
"error": "no suitable tags",
|
|
228
|
+
"date": None,
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@register_vcs_handler("git", "pieces_from_vcs")
|
|
233
|
+
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
234
|
+
"""Get version from 'git describe' in the root of the source tree.
|
|
235
|
+
|
|
236
|
+
This only gets called if the git-archive 'subst' keywords were *not*
|
|
237
|
+
expanded, and _version.py hasn't already been rewritten with a short
|
|
238
|
+
version string, meaning we're inside a checked out source tree.
|
|
239
|
+
"""
|
|
240
|
+
GITS = ["git"]
|
|
241
|
+
if sys.platform == "win32":
|
|
242
|
+
GITS = ["git.cmd", "git.exe"]
|
|
243
|
+
|
|
244
|
+
out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=True)
|
|
245
|
+
if rc != 0:
|
|
246
|
+
if verbose:
|
|
247
|
+
print("Directory %s not under git control" % root)
|
|
248
|
+
raise NotThisMethod("'git rev-parse --git-dir' returned error")
|
|
249
|
+
|
|
250
|
+
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
|
|
251
|
+
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
|
252
|
+
describe_out, rc = run_command(
|
|
253
|
+
GITS,
|
|
254
|
+
[
|
|
255
|
+
"describe",
|
|
256
|
+
"--tags",
|
|
257
|
+
"--dirty",
|
|
258
|
+
"--always",
|
|
259
|
+
"--long",
|
|
260
|
+
"--match",
|
|
261
|
+
"%s*" % tag_prefix,
|
|
262
|
+
],
|
|
263
|
+
cwd=root,
|
|
264
|
+
)
|
|
265
|
+
# --long was added in git-1.5.5
|
|
266
|
+
if describe_out is None:
|
|
267
|
+
raise NotThisMethod("'git describe' failed")
|
|
268
|
+
describe_out = describe_out.strip()
|
|
269
|
+
full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
|
|
270
|
+
if full_out is None:
|
|
271
|
+
raise NotThisMethod("'git rev-parse' failed")
|
|
272
|
+
full_out = full_out.strip()
|
|
273
|
+
|
|
274
|
+
pieces = {}
|
|
275
|
+
pieces["long"] = full_out
|
|
276
|
+
pieces["short"] = full_out[:7] # maybe improved later
|
|
277
|
+
pieces["error"] = None
|
|
278
|
+
|
|
279
|
+
# parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
|
|
280
|
+
# TAG might have hyphens.
|
|
281
|
+
git_describe = describe_out
|
|
282
|
+
|
|
283
|
+
# look for -dirty suffix
|
|
284
|
+
dirty = git_describe.endswith("-dirty")
|
|
285
|
+
pieces["dirty"] = dirty
|
|
286
|
+
if dirty:
|
|
287
|
+
git_describe = git_describe[: git_describe.rindex("-dirty")]
|
|
288
|
+
|
|
289
|
+
# now we have TAG-NUM-gHEX or HEX
|
|
290
|
+
|
|
291
|
+
if "-" in git_describe:
|
|
292
|
+
# TAG-NUM-gHEX
|
|
293
|
+
mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
|
|
294
|
+
if not mo:
|
|
295
|
+
# unparseable. Maybe git-describe is misbehaving?
|
|
296
|
+
pieces["error"] = "unable to parse git-describe output: '%s'" % describe_out
|
|
297
|
+
return pieces
|
|
298
|
+
|
|
299
|
+
# tag
|
|
300
|
+
full_tag = mo.group(1)
|
|
301
|
+
if not full_tag.startswith(tag_prefix):
|
|
302
|
+
if verbose:
|
|
303
|
+
fmt = "tag '%s' doesn't start with prefix '%s'"
|
|
304
|
+
print(fmt % (full_tag, tag_prefix))
|
|
305
|
+
pieces["error"] = "tag '%s' doesn't start with prefix '%s'" % (
|
|
306
|
+
full_tag,
|
|
307
|
+
tag_prefix,
|
|
308
|
+
)
|
|
309
|
+
return pieces
|
|
310
|
+
pieces["closest-tag"] = full_tag[len(tag_prefix) :]
|
|
311
|
+
|
|
312
|
+
# distance: number of commits since tag
|
|
313
|
+
pieces["distance"] = int(mo.group(2))
|
|
314
|
+
|
|
315
|
+
# commit: short hex revision ID
|
|
316
|
+
pieces["short"] = mo.group(3)
|
|
317
|
+
|
|
318
|
+
else:
|
|
319
|
+
# HEX: no tags
|
|
320
|
+
pieces["closest-tag"] = None
|
|
321
|
+
count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
|
|
322
|
+
pieces["distance"] = int(count_out) # total number of commits
|
|
323
|
+
|
|
324
|
+
# commit date: see ISO-8601 comment in git_versions_from_keywords()
|
|
325
|
+
date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[
|
|
326
|
+
0
|
|
327
|
+
].strip()
|
|
328
|
+
pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
|
|
329
|
+
|
|
330
|
+
return pieces
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def plus_or_dot(pieces):
|
|
334
|
+
"""Return a + if we don't already have one, else return a ."""
|
|
335
|
+
if "+" in pieces.get("closest-tag", ""):
|
|
336
|
+
return "."
|
|
337
|
+
return "+"
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def render_pep440(pieces):
|
|
341
|
+
"""Build up version string, with post-release "local version identifier".
|
|
342
|
+
|
|
343
|
+
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
|
|
344
|
+
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
|
|
345
|
+
|
|
346
|
+
Exceptions:
|
|
347
|
+
1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
|
|
348
|
+
"""
|
|
349
|
+
if pieces["closest-tag"]:
|
|
350
|
+
rendered = pieces["closest-tag"]
|
|
351
|
+
if pieces["distance"] or pieces["dirty"]:
|
|
352
|
+
rendered += plus_or_dot(pieces)
|
|
353
|
+
rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
|
|
354
|
+
if pieces["dirty"]:
|
|
355
|
+
rendered += ".dirty"
|
|
356
|
+
else:
|
|
357
|
+
# exception #1
|
|
358
|
+
rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"])
|
|
359
|
+
if pieces["dirty"]:
|
|
360
|
+
rendered += ".dirty"
|
|
361
|
+
return rendered
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def render_pep440_pre(pieces):
|
|
365
|
+
"""TAG[.post.devDISTANCE] -- No -dirty.
|
|
366
|
+
|
|
367
|
+
Exceptions:
|
|
368
|
+
1: no tags. 0.post.devDISTANCE
|
|
369
|
+
"""
|
|
370
|
+
if pieces["closest-tag"]:
|
|
371
|
+
rendered = pieces["closest-tag"]
|
|
372
|
+
if pieces["distance"]:
|
|
373
|
+
rendered += ".post.dev%d" % pieces["distance"]
|
|
374
|
+
else:
|
|
375
|
+
# exception #1
|
|
376
|
+
rendered = "0.post.dev%d" % pieces["distance"]
|
|
377
|
+
return rendered
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def render_pep440_post(pieces):
|
|
381
|
+
"""TAG[.postDISTANCE[.dev0]+gHEX] .
|
|
382
|
+
|
|
383
|
+
The ".dev0" means dirty. Note that .dev0 sorts backwards
|
|
384
|
+
(a dirty tree will appear "older" than the corresponding clean one),
|
|
385
|
+
but you shouldn't be releasing software with -dirty anyways.
|
|
386
|
+
|
|
387
|
+
Exceptions:
|
|
388
|
+
1: no tags. 0.postDISTANCE[.dev0]
|
|
389
|
+
"""
|
|
390
|
+
if pieces["closest-tag"]:
|
|
391
|
+
rendered = pieces["closest-tag"]
|
|
392
|
+
if pieces["distance"] or pieces["dirty"]:
|
|
393
|
+
rendered += ".post%d" % pieces["distance"]
|
|
394
|
+
if pieces["dirty"]:
|
|
395
|
+
rendered += ".dev0"
|
|
396
|
+
rendered += plus_or_dot(pieces)
|
|
397
|
+
rendered += "g%s" % pieces["short"]
|
|
398
|
+
else:
|
|
399
|
+
# exception #1
|
|
400
|
+
rendered = "0.post%d" % pieces["distance"]
|
|
401
|
+
if pieces["dirty"]:
|
|
402
|
+
rendered += ".dev0"
|
|
403
|
+
rendered += "+g%s" % pieces["short"]
|
|
404
|
+
return rendered
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def render_pep440_old(pieces):
|
|
408
|
+
"""TAG[.postDISTANCE[.dev0]] .
|
|
409
|
+
|
|
410
|
+
The ".dev0" means dirty.
|
|
411
|
+
|
|
412
|
+
Eexceptions:
|
|
413
|
+
1: no tags. 0.postDISTANCE[.dev0]
|
|
414
|
+
"""
|
|
415
|
+
if pieces["closest-tag"]:
|
|
416
|
+
rendered = pieces["closest-tag"]
|
|
417
|
+
if pieces["distance"] or pieces["dirty"]:
|
|
418
|
+
rendered += ".post%d" % pieces["distance"]
|
|
419
|
+
if pieces["dirty"]:
|
|
420
|
+
rendered += ".dev0"
|
|
421
|
+
else:
|
|
422
|
+
# exception #1
|
|
423
|
+
rendered = "0.post%d" % pieces["distance"]
|
|
424
|
+
if pieces["dirty"]:
|
|
425
|
+
rendered += ".dev0"
|
|
426
|
+
return rendered
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def render_git_describe(pieces):
|
|
430
|
+
"""TAG[-DISTANCE-gHEX][-dirty].
|
|
431
|
+
|
|
432
|
+
Like 'git describe --tags --dirty --always'.
|
|
433
|
+
|
|
434
|
+
Exceptions:
|
|
435
|
+
1: no tags. HEX[-dirty] (note: no 'g' prefix)
|
|
436
|
+
"""
|
|
437
|
+
if pieces["closest-tag"]:
|
|
438
|
+
rendered = pieces["closest-tag"]
|
|
439
|
+
if pieces["distance"]:
|
|
440
|
+
rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
|
|
441
|
+
else:
|
|
442
|
+
# exception #1
|
|
443
|
+
rendered = pieces["short"]
|
|
444
|
+
if pieces["dirty"]:
|
|
445
|
+
rendered += "-dirty"
|
|
446
|
+
return rendered
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def render_git_describe_long(pieces):
|
|
450
|
+
"""TAG-DISTANCE-gHEX[-dirty].
|
|
451
|
+
|
|
452
|
+
Like 'git describe --tags --dirty --always -long'.
|
|
453
|
+
The distance/hash is unconditional.
|
|
454
|
+
|
|
455
|
+
Exceptions:
|
|
456
|
+
1: no tags. HEX[-dirty] (note: no 'g' prefix)
|
|
457
|
+
"""
|
|
458
|
+
if pieces["closest-tag"]:
|
|
459
|
+
rendered = pieces["closest-tag"]
|
|
460
|
+
rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
|
|
461
|
+
else:
|
|
462
|
+
# exception #1
|
|
463
|
+
rendered = pieces["short"]
|
|
464
|
+
if pieces["dirty"]:
|
|
465
|
+
rendered += "-dirty"
|
|
466
|
+
return rendered
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
def render(pieces, style):
|
|
470
|
+
"""Render the given version pieces into the requested style."""
|
|
471
|
+
if pieces["error"]:
|
|
472
|
+
return {
|
|
473
|
+
"version": "unknown",
|
|
474
|
+
"full-revisionid": pieces.get("long"),
|
|
475
|
+
"dirty": None,
|
|
476
|
+
"error": pieces["error"],
|
|
477
|
+
"date": None,
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
if not style or style == "default":
|
|
481
|
+
style = "pep440" # the default
|
|
482
|
+
|
|
483
|
+
if style == "pep440":
|
|
484
|
+
rendered = render_pep440(pieces)
|
|
485
|
+
elif style == "pep440-pre":
|
|
486
|
+
rendered = render_pep440_pre(pieces)
|
|
487
|
+
elif style == "pep440-post":
|
|
488
|
+
rendered = render_pep440_post(pieces)
|
|
489
|
+
elif style == "pep440-old":
|
|
490
|
+
rendered = render_pep440_old(pieces)
|
|
491
|
+
elif style == "git-describe":
|
|
492
|
+
rendered = render_git_describe(pieces)
|
|
493
|
+
elif style == "git-describe-long":
|
|
494
|
+
rendered = render_git_describe_long(pieces)
|
|
495
|
+
else:
|
|
496
|
+
raise ValueError("unknown style '%s'" % style)
|
|
497
|
+
|
|
498
|
+
return {
|
|
499
|
+
"version": rendered,
|
|
500
|
+
"full-revisionid": pieces["long"],
|
|
501
|
+
"dirty": pieces["dirty"],
|
|
502
|
+
"error": None,
|
|
503
|
+
"date": pieces.get("date"),
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
def get_versions():
|
|
508
|
+
"""Get version information or return default if unable to do so."""
|
|
509
|
+
# I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
|
|
510
|
+
# __file__, we can work backwards from there to the root. Some
|
|
511
|
+
# py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
|
|
512
|
+
# case we can only use expanded keywords.
|
|
513
|
+
|
|
514
|
+
cfg = get_config()
|
|
515
|
+
verbose = cfg.verbose
|
|
516
|
+
|
|
517
|
+
try:
|
|
518
|
+
return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
|
|
519
|
+
except NotThisMethod:
|
|
520
|
+
pass
|
|
521
|
+
|
|
522
|
+
try:
|
|
523
|
+
root = os.path.realpath(__file__)
|
|
524
|
+
# versionfile_source is the relative path from the top of the source
|
|
525
|
+
# tree (where the .git directory might live) to this file. Invert
|
|
526
|
+
# this to find the root from __file__.
|
|
527
|
+
for i in cfg.versionfile_source.split("/"):
|
|
528
|
+
root = os.path.dirname(root)
|
|
529
|
+
except NameError:
|
|
530
|
+
return {
|
|
531
|
+
"version": "0+unknown",
|
|
532
|
+
"full-revisionid": None,
|
|
533
|
+
"dirty": None,
|
|
534
|
+
"error": "unable to find root of source tree",
|
|
535
|
+
"date": None,
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
try:
|
|
539
|
+
pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
|
|
540
|
+
return render(pieces, cfg.style)
|
|
541
|
+
except NotThisMethod:
|
|
542
|
+
pass
|
|
543
|
+
|
|
544
|
+
try:
|
|
545
|
+
if cfg.parentdir_prefix:
|
|
546
|
+
return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
|
|
547
|
+
except NotThisMethod:
|
|
548
|
+
pass
|
|
549
|
+
|
|
550
|
+
return {
|
|
551
|
+
"version": "0+unknown",
|
|
552
|
+
"full-revisionid": None,
|
|
553
|
+
"dirty": None,
|
|
554
|
+
"error": "unable to compute version",
|
|
555
|
+
"date": None,
|
|
556
|
+
}
|