Instructions to use OrionZheng/openmoe-8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OrionZheng/openmoe-8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OrionZheng/openmoe-8b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("OrionZheng/openmoe-8b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("OrionZheng/openmoe-8b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OrionZheng/openmoe-8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OrionZheng/openmoe-8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OrionZheng/openmoe-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OrionZheng/openmoe-8b
- SGLang
How to use OrionZheng/openmoe-8b 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 "OrionZheng/openmoe-8b" \ --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": "OrionZheng/openmoe-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "OrionZheng/openmoe-8b" \ --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": "OrionZheng/openmoe-8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OrionZheng/openmoe-8b with Docker Model Runner:
docker model run hf.co/OrionZheng/openmoe-8b
Model source code
It seems that README.md is incorrect and usage guide is inaccurate in general.
There is no such branch my_openmoe in hpcaitech/ColossalAI. It seems that actual branch is feat/moe. Anyway, it is a separate headache building from sources third-party library.
Thank you for pointing that out. It seems the Colab link has expired. Please try these two Colab links for compilation or inference demo. Since OpenMoE were released about a year ago, using an older version of ColossalAI should work fine. The Colab demo includes an archived version of ColossalAI from that time. If you encounter any issue, feel free to let me know!
https://drive.google.com/file/d/1porVkP1zQnazu4kgGij4PpBx7h7n8ow7/view?usp=sharing
https://drive.google.com/file/d/1TbFT7ACuHbb7o2WAJn_KKmfvUzN9Z_Xs/view?usp=sharing
Thank you for sharing your notebooks!
However, it would be great to update model card in these lines in order to not lose people interested in OpenMoE but who don't figure out with colossalai package.