How to use from
SGLang
Install from pip and serve model
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
    --model-path "shanchen/llama3-8B-slerp-biomed-chat-chinese" \
    --host 0.0.0.0 \
    --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "shanchen/llama3-8B-slerp-biomed-chat-chinese",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Use Docker images
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 "shanchen/llama3-8B-slerp-biomed-chat-chinese" \
        --host 0.0.0.0 \
        --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "shanchen/llama3-8B-slerp-biomed-chat-chinese",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Quick Links

llama3-8B-slerp-biomed-chat-chinese

llama3-8B-slerp-biomed-chat-chinese is a merge of the following models using LazyMergekit:

🧩 Configuration

slices:
  - sources:
      - model: shanchen/llama3-8B-slerp-med-chinese
        layer_range: [0,32]
      - model: shenzhi-wang/Llama3-8B-Chinese-Chat
        layer_range: [0,32]
merge_method: slerp
base_model: shenzhi-wang/Llama3-8B-Chinese-Chat
parameters:
  t:
    - filter: self_attn
      value: [0.3, 0.5, 0.5, 0.7, 1]
    - filter: mlp
      value: [1, 0.7, 0.5, 0.5, 0.3]
    - value: 0.5
dtype: bfloat16

πŸ’» Usage

!pip install -qU transformers accelerate

from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "shanchen/llama3-8B-slerp-biomed-chat-chinese"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id, torch_dtype="auto", device_map="auto"
)

messages = [
    {"role": "user", "content": "Can you speak Japanese?"},
]

input_ids = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)

outputs = model.generate(
    input_ids,
    max_new_tokens=192 max#8192,
    do_sample=True,
    temperature=0.6,
    top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
Downloads last month
8,183
Safetensors
Model size
8B params
Tensor type
BF16
Β·
Inference Providers NEW
Input a message to start chatting with shanchen/llama3-8B-slerp-biomed-chat-chinese.

Model tree for shanchen/llama3-8B-slerp-biomed-chat-chinese

Spaces using shanchen/llama3-8B-slerp-biomed-chat-chinese 9