Resolving Interference When Merging Models
Paper • 2306.01708 • Published • 18
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Ppoyaa/Alpha-Mistral-7B-Instruct")
model = AutoModelForCausalLM.from_pretrained("Ppoyaa/Alpha-Mistral-7B-Instruct")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))This is a merge of pre-trained language models created using mergekit.
This model was merged using the TIES merge method using mistralai/Mistral-7B-Instruct-v0.2 as a base.
The following models were included in the merge:
The following YAML configuration was used to produce this model:
models:
- model: mistralai/Mistral-7B-Instruct-v0.2
#no parameters necessary for base model
- model: mlabonne/AlphaMonarch-7B
parameters:
density: 0.5
weight: 0.5
- model: nvidia/OpenMath-Mistral-7B-v0.1-hf
parameters:
density: 0.5
weight: 0.5
merge_method: ties
base_model: mistralai/Mistral-7B-Instruct-v0.2
parameters:
normalize: false
int8_mask: true
dtype: float16
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ppoyaa/Alpha-Mistral-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)