Language Models are Super Mario: Absorbing Abilities from Homologous Models as a Free Lunch
Paper • 2311.03099 • Published • 33
How to use shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct")
model = AutoModelForCausalLM.from_pretrained("shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct")How to use shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct
How to use shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct with Docker Model Runner:
docker model run hf.co/shidowake/test-240115-mergekit-CodeLlama-Swallow-7b-instruct
This is a merge of pre-trained language models created using mergekit.
This model was merged using the DARE TIES merge method using tokyotech-llm/Swallow-7b-instruct-hf as a base.
The following models were included in the merge:
The following YAML configuration was used to produce this model:
models:
- model: tokyotech-llm/Swallow-7b-instruct-hf
# no parameters necessary for base model
- model: codellama/CodeLlama-7b-Python-hf # follow user intent
parameters:
density: 1
weight:
- filter: mlp.down_proj
value: [0.3, 0.25, 0.25, 0.15, 0.1]
- filter: mlp.gate_proj
value: [0.7, 0.25, 0.5, 0.45, 0.4]
- filter: mlp.up_proj
value: [0.7, 0.25, 0.5, 0.45, 0.4]
- filter: self_attn
value: [0.7, 0.25, 0.5, 0.45, 0.4]
- value: 0 # fallback for rest of tensors.
merge_method: dare_ties
base_model: tokyotech-llm/Swallow-7b-instruct-hf
dtype: bfloat16
tokenizer_source: union