L3.1-Moe
Collection
https://github.com/moeru-ai/L3.1-Moe • 3 items • Updated • 1
How to use moeru-ai/L3.1-Moe-4x8B-v0.2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="moeru-ai/L3.1-Moe-4x8B-v0.2")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("moeru-ai/L3.1-Moe-4x8B-v0.2")
model = AutoModelForCausalLM.from_pretrained("moeru-ai/L3.1-Moe-4x8B-v0.2")
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]:]))How to use moeru-ai/L3.1-Moe-4x8B-v0.2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "moeru-ai/L3.1-Moe-4x8B-v0.2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "moeru-ai/L3.1-Moe-4x8B-v0.2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/moeru-ai/L3.1-Moe-4x8B-v0.2
How to use moeru-ai/L3.1-Moe-4x8B-v0.2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "moeru-ai/L3.1-Moe-4x8B-v0.2" \
--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": "moeru-ai/L3.1-Moe-4x8B-v0.2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "moeru-ai/L3.1-Moe-4x8B-v0.2" \
--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": "moeru-ai/L3.1-Moe-4x8B-v0.2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use moeru-ai/L3.1-Moe-4x8B-v0.2 with Docker Model Runner:
docker model run hf.co/moeru-ai/L3.1-Moe-4x8B-v0.2
This model is a Mixture of Experts (MoE) made with mergekit-moe. It uses the following base models:
Heavily inspired by mlabonne/Beyonder-4x7B-v3.
base_model: Joseph717171/Llama-3.1-SuperNova-8B-Lite_TIES_with_Base
gate_mode: hidden
dtype: bfloat16
experts:
- source_model: Joseph717171/Llama-3.1-SuperNova-8B-Lite_TIES_with_Base
positive_prompts: &chat_prompts
- "chat"
- "assistant"
- "tell me"
- "explain"
- "I want"
negative_prompts: &rp_prompts
- "storywriting"
- "write"
- "scene"
- "story"
- "character"
- source_model: ArliAI/Llama-3.1-8B-ArliAI-RPMax-v1.2
positive_prompts: *rp_prompts
negative_prompts: *chat_prompts
- source_model: rombodawg/rombos_Replete-Coder-Instruct-8b-Merged
positive_prompts:
- "code"
- "python"
- "javascript"
- "programming"
- "algorithm"
- source_model: 3rd-Degree-Burn/Llama-3.1-8B-Squareroot-v0
positive_prompts:
- "reason"
- "math"
- "mathematics"
- "solve"
- "count"
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 17.47 |
| IFEval (0-Shot) | 54.07 |
| BBH (3-Shot) | 21.34 |
| MATH Lvl 5 (4-Shot) | 5.29 |
| GPQA (0-shot) | 2.24 |
| MuSR (0-shot) | 2.29 |
| MMLU-PRO (5-shot) | 19.58 |