All source adapters share the following configuration:
Rank (r): 16
Alpha: 16
Target Modules:
q_proj (Query projection)
k_proj (Key projection)
v_proj (Value projection)
o_proj (Output projection)
up_proj (Upsampling projection)
down_proj (Downsampling projection)
gate_proj (Gate projection)
Merger Details
Merger Method: Linear interpolation
Merger Weights: Equal weights (0.25) for each adapter
Combined Rank: 16 (maintained from source adapters)
Usage
This merged adapter must be used with the base Llama-3.1-8B-instruct model.
Loading the Model
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load base model
base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-instruct")
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-instruct")
# Load merged LoRA adapter
model = PeftModel.from_pretrained(base_model, "path_to_merged_adapter")
Limitations and Biases
This merged adapter inherits limitations and biases from:
The base Llama-3.1-8B-instruct model
All four source adapters
The merging process may result in:
Potential loss of specialized capabilities from individual adapters
Averaged behavior across different adapter specializations
Possible interference between adapter weights
Merging Process
The adapters were merged using the following approach:
Linear interpolation of adapter weights
Equal weighting (0.25) applied to each source adapter
Preservation of original LoRA rank and architecture
Method Used
The adapters were merged using PEFT (Parameter-Efficient Fine-Tuning) library's weighted adapter combination feature. The process combines multiple LoRA adapters using linear interpolation with specified weights.
Step-by-Step Merging Process
Load the base model and initial adapter:
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_NAME = "meta-llama/Meta-Llama-3.1-8B-Instruct"
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
# Load first adapter as base
peft_model = PeftModel.from_pretrained(model, "llama319", adapter_name="llama319")
# Define adapters and their weights
adapters = ["llama319", "llama320", "llama318", "llama317"]
weights = [1.0, 1.0, 1.0, 1.0] # Equal weights for all adapters# Merge adapters
peft_model.add_weighted_adapter(
adapters,
weights,
"merge",
combination_type="ties", # Using ties combination method
density=0.2# Density parameter for merger
)
# Set active adapter to merged version
peft_model.set_adapter("merge")
# Save the merged adapter
peft_model.save_pretrained("merged")
Key Parameters
combination_type="ties"
: Uses the TIES (Task Interference Edge Selection) method for combining adapters
density=0.2
: Controls the sparsity of the merged weights
weights=[1.0, 1.0, 1.0, 1.0]
: Equal weighting for all adapters (0.25 each after normalization)
Notes
The order of loading adapters may affect the final result
Equal weights were chosen to maintain balanced influence from each adapter
The merged adapter maintains the same architecture and rank as the original adapters
While this adapter merges multiple fine-tunes, each component was developed as part of independent research efforts to explore and language model capabilities as part of R&D process.
License
Licensed under Apache 2.0 License.
This merged adapter is part of independent individual research work. While the code is open-source under the Apache 2.0 license, please note:
You are free to use, modify, and distribute this adapter following the Apache 2.0 license terms
This work is provided "as is" without warranties or conditions of any kind
This is an independent research project and not affiliated with any organization
merge-17-20 huggingface.co is an AI model on huggingface.co that provides merge-17-20's model effect (), which can be used instantly with this kevin009 merge-17-20 model. huggingface.co supports a free trial of the merge-17-20 model, and also provides paid use of the merge-17-20. Support call merge-17-20 model through api, including Node.js, Python, http.
merge-17-20 huggingface.co is an online trial and call api platform, which integrates merge-17-20's modeling effects, including api services, and provides a free online trial of merge-17-20, you can try merge-17-20 online for free by clicking the link below.
kevin009 merge-17-20 online free url in huggingface.co:
merge-17-20 is an open source model from GitHub that offers a free installation service, and any user can find merge-17-20 on GitHub to install. At the same time, huggingface.co provides the effect of merge-17-20 install, users can directly use merge-17-20 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.