Text Generation
Transformers
Safetensors
English
Chinese
megrez_moe
Mixture of Experts
conversational
custom_code
Instructions to use Infinigence/Megrez2-3x7B-A3B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Infinigence/Megrez2-3x7B-A3B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Infinigence/Megrez2-3x7B-A3B-Preview", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Infinigence/Megrez2-3x7B-A3B-Preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Infinigence/Megrez2-3x7B-A3B-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Infinigence/Megrez2-3x7B-A3B-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Infinigence/Megrez2-3x7B-A3B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Infinigence/Megrez2-3x7B-A3B-Preview
- SGLang
How to use Infinigence/Megrez2-3x7B-A3B-Preview with 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 "Infinigence/Megrez2-3x7B-A3B-Preview" \ --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": "Infinigence/Megrez2-3x7B-A3B-Preview", "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 "Infinigence/Megrez2-3x7B-A3B-Preview" \ --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": "Infinigence/Megrez2-3x7B-A3B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Infinigence/Megrez2-3x7B-A3B-Preview with Docker Model Runner:
docker model run hf.co/Infinigence/Megrez2-3x7B-A3B-Preview
fix rope base
Browse files- README.md +1 -1
- README_ZH.md +1 -1
- config.json +1 -1
README.md
CHANGED
|
@@ -59,7 +59,7 @@ Megrez2-3x7B-A3B-Preview is a device native large language model. Megrez2 takes
|
|
| 59 |
| **Number of Shared Experts** | 4 |
|
| 60 |
| **Vocabulary Size** | 128,880 |
|
| 61 |
| **Context Length** | 32K |
|
| 62 |
-
| **Base Frequency of RoPE** |
|
| 63 |
| **Attention Mechanism** | GQA |
|
| 64 |
| **Activation Function** | SwiGLU |
|
| 65 |
</div>
|
|
|
|
| 59 |
| **Number of Shared Experts** | 4 |
|
| 60 |
| **Vocabulary Size** | 128,880 |
|
| 61 |
| **Context Length** | 32K |
|
| 62 |
+
| **Base Frequency of RoPE** | 5,000,000 |
|
| 63 |
| **Attention Mechanism** | GQA |
|
| 64 |
| **Activation Function** | SwiGLU |
|
| 65 |
</div>
|
README_ZH.md
CHANGED
|
@@ -47,7 +47,7 @@ Megrez2-3x7B-A3B-Preview 是专为终端设备设计的大模型,兼顾MoE的
|
|
| 47 |
| **Number of Shared Experts** | 4 |
|
| 48 |
| **Vocabulary Size** | 128,880 |
|
| 49 |
| **Context Length** | 32K |
|
| 50 |
-
| **Base Frequency of RoPE** |
|
| 51 |
| **Attention Mechanism** | GQA |
|
| 52 |
| **Activation Function** | SwiGLU |
|
| 53 |
</div>
|
|
|
|
| 47 |
| **Number of Shared Experts** | 4 |
|
| 48 |
| **Vocabulary Size** | 128,880 |
|
| 49 |
| **Context Length** | 32K |
|
| 50 |
+
| **Base Frequency of RoPE** | 5,000,000 |
|
| 51 |
| **Attention Mechanism** | GQA |
|
| 52 |
| **Activation Function** | SwiGLU |
|
| 53 |
</div>
|
config.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
"pretraining_tp": 1,
|
| 37 |
"rms_norm_eps": 1e-06,
|
| 38 |
"rope_scaling": null,
|
| 39 |
-
"rope_theta":
|
| 40 |
"routed_scaling_factor": 1.0,
|
| 41 |
"scoring_func": "softmax",
|
| 42 |
"seq_aux": true,
|
|
|
|
| 36 |
"pretraining_tp": 1,
|
| 37 |
"rms_norm_eps": 1e-06,
|
| 38 |
"rope_scaling": null,
|
| 39 |
+
"rope_theta": 5000000,
|
| 40 |
"routed_scaling_factor": 1.0,
|
| 41 |
"scoring_func": "softmax",
|
| 42 |
"seq_aux": true,
|