Text Generation
Transformers
Safetensors
English
Chinese
Russian
yue2
music-generation
orbitquant
quantization
4-bit precision
custom-code
8-bit precision
Instructions to use WaveCut/YuE2-3B-OrbitQuant-W4A4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WaveCut/YuE2-3B-OrbitQuant-W4A4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WaveCut/YuE2-3B-OrbitQuant-W4A4")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("WaveCut/YuE2-3B-OrbitQuant-W4A4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WaveCut/YuE2-3B-OrbitQuant-W4A4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WaveCut/YuE2-3B-OrbitQuant-W4A4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WaveCut/YuE2-3B-OrbitQuant-W4A4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/WaveCut/YuE2-3B-OrbitQuant-W4A4
- SGLang
How to use WaveCut/YuE2-3B-OrbitQuant-W4A4 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 "WaveCut/YuE2-3B-OrbitQuant-W4A4" \ --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": "WaveCut/YuE2-3B-OrbitQuant-W4A4", "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 "WaveCut/YuE2-3B-OrbitQuant-W4A4" \ --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": "WaveCut/YuE2-3B-OrbitQuant-W4A4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use WaveCut/YuE2-3B-OrbitQuant-W4A4 with Docker Model Runner:
docker model run hf.co/WaveCut/YuE2-3B-OrbitQuant-W4A4
| STABLE_TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) { | |
| ops.def( | |
| "matmul_packed_weight(Tensor! out, Tensor x, Tensor packed_weight_indices, " | |
| "Tensor row_norms, Tensor centroids, Tensor bias, bool has_bias, int bits, " | |
| "int out_features, int in_features, int block_m, int block_n, int block_k) -> ()"); | |
| ops.def( | |
| "quantize_activations_cpu(Tensor! out, Tensor x, Tensor permutation, " | |
| "Tensor signs, Tensor centroids, Tensor boundaries, float eps, " | |
| "float inv_sqrt_block, int block_size) -> ()"); | |
| ops.def( | |
| "matmul_packed_adaln_int4_cpu(Tensor! out, Tensor x, Tensor packed_weight, " | |
| "Tensor scales, Tensor bias, bool has_bias, int out_features, " | |
| "int in_features, int group_size) -> ()"); | |
| } | |
| STABLE_TORCH_LIBRARY_IMPL_EXPAND(TORCH_EXTENSION_NAME, CPU, ops) { | |
| ops.impl("matmul_packed_weight", TORCH_BOX(&matmul_packed_weight)); | |
| ops.impl("quantize_activations_cpu", TORCH_BOX(&quantize_activations_cpu)); | |
| ops.impl( | |
| "matmul_packed_adaln_int4_cpu", | |
| TORCH_BOX(&matmul_packed_adaln_int4_cpu)); | |
| } | |
| TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) { | |
| ops.def( | |
| "matmul_packed_weight(Tensor! out, Tensor x, Tensor packed_weight_indices, " | |
| "Tensor row_norms, Tensor centroids, Tensor bias, bool has_bias, int bits, " | |
| "int out_features, int in_features, int block_m, int block_n, int block_k) -> ()"); | |
| ops.impl("matmul_packed_weight", torch::kCUDA, &matmul_packed_weight); | |
| ops.def( | |
| "matmul_packed_w4a4_int8(Tensor! out, Tensor packed_activations, " | |
| "Tensor packed_weight_indices, Tensor token_norms, Tensor row_norms, " | |
| "Tensor activation_codes, Tensor weight_codes, Tensor bias, bool has_bias, " | |
| "float activation_scale, float weight_scale, int out_features, " | |
| "int in_features, int tile_m, int tile_n, bool async_packed, " | |
| "bool weight_k_major) -> ()"); | |
| ops.impl("matmul_packed_w4a4_int8", torch::kCUDA, &matmul_packed_w4a4_int8); | |
| ops.def( | |
| "quantize_activations_packed_w4(Tensor! packed_out, Tensor! norms_out, " | |
| "Tensor x, Tensor permutation, Tensor signs, Tensor boundaries, float eps, " | |
| "float inv_sqrt_block, int threads) -> ()"); | |
| ops.impl( | |
| "quantize_activations_packed_w4", | |
| torch::kCUDA, | |
| &quantize_activations_packed_w4); | |
| ops.def( | |
| "quantize_activations_int8(Tensor! int8_out, Tensor! norms_out, Tensor x, " | |
| "Tensor permutation, Tensor signs, Tensor boundaries, Tensor codes, float eps, " | |
| "float inv_sqrt_block, int threads) -> ()"); | |
| ops.impl( | |
| "quantize_activations_int8", | |
| torch::kCUDA, | |
| &quantize_activations_int8); | |
| ops.impl("matmul_packed_weight", torch::kMPS, &matmul_packed_weight); | |
| } | |
| REGISTER_EXTENSION(TORCH_EXTENSION_NAME) | |