Text Generation
Transformers
Safetensors
English
Chinese
megrez_moe
Mixture of Experts
conversational
custom_code
Instructions to use Infinigence/Megrez2-3x7B-A3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Infinigence/Megrez2-3x7B-A3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Infinigence/Megrez2-3x7B-A3B", 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", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Infinigence/Megrez2-3x7B-A3B 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" # 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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Infinigence/Megrez2-3x7B-A3B
- SGLang
How to use Infinigence/Megrez2-3x7B-A3B 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" \ --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", "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" \ --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", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Infinigence/Megrez2-3x7B-A3B with Docker Model Runner:
docker model run hf.co/Infinigence/Megrez2-3x7B-A3B
liyadong commited on
Commit ·
af1cd40
1
Parent(s): b20e44e
update llama.cpp note
Browse files- README.md +1 -1
- README_ZH.md +2 -1
README.md
CHANGED
|
@@ -209,7 +209,7 @@ from modelscope import AutoModelForCausalLM, AutoTokenizer
|
|
| 209 |
|
| 210 |
### llama.cpp
|
| 211 |
|
| 212 |
-
|
| 213 |
|
| 214 |
## How to Deploy
|
| 215 |
|
|
|
|
| 209 |
|
| 210 |
### llama.cpp
|
| 211 |
|
| 212 |
+
llama.cpp enables LLM inference with minimal setup and state-of-the-art performance on a wide range of hardware. Now supported, please refer to the [support-megrez branch](https://github.com/infinigence/llama.cpp/tree/support-megrez) for details.
|
| 213 |
|
| 214 |
## How to Deploy
|
| 215 |
|
README_ZH.md
CHANGED
|
@@ -196,7 +196,8 @@ from modelscope import AutoModelForCausalLM, AutoTokenizer
|
|
| 196 |
```
|
| 197 |
|
| 198 |
### llama.cpp
|
| 199 |
-
|
|
|
|
| 200 |
|
| 201 |
## 如何部署
|
| 202 |
|
|
|
|
| 196 |
```
|
| 197 |
|
| 198 |
### llama.cpp
|
| 199 |
+
|
| 200 |
+
llama.cpp 支持在各种硬件上以最小的设置和最先进的性能来启用LLM推断。现已支持,具体请查看 [support-megrez 分支](https://github.com/infinigence/llama.cpp/tree/support-megrez)。
|
| 201 |
|
| 202 |
## 如何部署
|
| 203 |
|