Instructions to use xDAN2099/APUS-xDAN-4.0-MoE-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xDAN2099/APUS-xDAN-4.0-MoE-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xDAN2099/APUS-xDAN-4.0-MoE-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("xDAN2099/APUS-xDAN-4.0-MoE-v2") model = AutoModelForCausalLM.from_pretrained("xDAN2099/APUS-xDAN-4.0-MoE-v2") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xDAN2099/APUS-xDAN-4.0-MoE-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xDAN2099/APUS-xDAN-4.0-MoE-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xDAN2099/APUS-xDAN-4.0-MoE-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xDAN2099/APUS-xDAN-4.0-MoE-v2
- SGLang
How to use xDAN2099/APUS-xDAN-4.0-MoE-v2 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 "xDAN2099/APUS-xDAN-4.0-MoE-v2" \ --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": "xDAN2099/APUS-xDAN-4.0-MoE-v2", "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 "xDAN2099/APUS-xDAN-4.0-MoE-v2" \ --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": "xDAN2099/APUS-xDAN-4.0-MoE-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use xDAN2099/APUS-xDAN-4.0-MoE-v2 with Docker Model Runner:
docker model run hf.co/xDAN2099/APUS-xDAN-4.0-MoE-v2
Introduction APUS-xDAN-4.0-MOE is a transformer-based decoder-only language model, developed on a vast corpus of data to ensure robust performance.
This is an enhanced MoE (Mixture of Experts) model built on top of the continued pre-training enhanced LlaMA architecture, further optimized with human-enhanced feedback algorithms to improve reasoning, mathematical, and logical capabilities during inference.
For more comprehensive information, please visit our blog post and GitHub repository. https://github.com/shootime2021/APUS-xDAN-4.0-moe
Model Details APUS-xDAN-4.0-MOE leverages the innovative Mixture of Experts (MoE) architecture, incorporating components from dense language models. Specifically, it inherits its capabilities from the highly performant xDAN-L2 Series. With a total of 136 billion parameters, of which 30 billion are activated during runtime, APUS-xDAN-4.0-MOE demonstrates unparalleled efficiency. Through advanced quantization techniques, our open-source version occupies a mere 42GB, making it seamlessly compatible with consumer-grade GPUs like the 4090 and 3090. The following specifications:
Parameters: 136B Architecture: Mixture of 4 Experts (MoE) Experts Utilization: 2 experts used per token Layers: 60 Attention Heads: 56 for queries, 8 for keys/values Embedding Size: 7,168 Additional Features: Rotary embeddings (RoPE) Supports activation sharding and 1.5bit~4bit quantization Maximum Sequence Length (context): 32,768 tokens
- Downloads last month
- 3