Instructions to use Uni-MoE/Uni-MoE-speech-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Uni-MoE/Uni-MoE-speech-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Uni-MoE/Uni-MoE-speech-base")# Load model directly from transformers import AutoProcessor, AutoModelForCausalLM processor = AutoProcessor.from_pretrained("Uni-MoE/Uni-MoE-speech-base") model = AutoModelForCausalLM.from_pretrained("Uni-MoE/Uni-MoE-speech-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Uni-MoE/Uni-MoE-speech-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Uni-MoE/Uni-MoE-speech-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Uni-MoE/Uni-MoE-speech-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Uni-MoE/Uni-MoE-speech-base
- SGLang
How to use Uni-MoE/Uni-MoE-speech-base 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 "Uni-MoE/Uni-MoE-speech-base" \ --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": "Uni-MoE/Uni-MoE-speech-base", "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 "Uni-MoE/Uni-MoE-speech-base" \ --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": "Uni-MoE/Uni-MoE-speech-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Uni-MoE/Uni-MoE-speech-base with Docker Model Runner:
docker model run hf.co/Uni-MoE/Uni-MoE-speech-base
| { | |
| "_name_or_path": "/path/to/Uni-MoE-speech-base", | |
| "architectures": [ | |
| "LlavaLlamaForCausalLM" | |
| ], | |
| "bos_token_id": 1, | |
| "eos_token_id": 2, | |
| "freeze_mm_mlp_adapter": false, | |
| "freeze_mm_vision_resampler": false, | |
| "hidden_act": "silu", | |
| "hidden_size": 4096, | |
| "image_aspect_ratio": "pad", | |
| "initializer_range": 0.02, | |
| "intermediate_size": 11008, | |
| "language": "English", | |
| "local_files_only": false, | |
| "max_length": 4096, | |
| "max_position_embeddings": 4096, | |
| "mm_audio_hidden_size": 768, | |
| "mm_audio_select_feature": "patch", | |
| "mm_audio_select_layer": 0, | |
| "mm_audio_tower": "/path/to/whisper-small", | |
| "mm_hidden_size": 1024, | |
| "mm_projector_type": "mlp2x_gelu", | |
| "mm_query_tokens": true, | |
| "mm_resampler_type": null, | |
| "mm_use_im_patch_token": false, | |
| "mm_use_im_start_end": false, | |
| "mm_vision_select_feature": "patch", | |
| "mm_vision_select_layer": -2, | |
| "mm_vision_tower": "/path/to/clip-vit-large-patch14-336", | |
| "model_type": "llava_llama", | |
| "moe": true, | |
| "num_attention_heads": 32, | |
| "num_experts": 8, | |
| "num_experts_per_tok": 2, | |
| "moe_type": "dense", | |
| "ep_size": 8, | |
| "capacity_factor": 1.5, | |
| "lora_r": 8, | |
| "lora_alpha": 16, | |
| "image_expert_indices": [2, 3, 4, 6], | |
| "video_expert_indices": [2, 3, 4, 6], | |
| "audio_expert_indices": [0, 4, 5, 7], | |
| "use_fm_block": false, | |
| "use_flash_attn": false, | |
| "aux_balance_loss": true, | |
| "aux_balance_loss_coef": 0.01, | |
| "aux_multimodal_loss": false, | |
| "aux_multimodal_loss_coef": 0.01, | |
| "aux_kl_loss": false, | |
| "aux_kl_loss_coef": 0.01, | |
| "lora_dropout": 0.05, | |
| "num_hidden_layers": 32, | |
| "num_key_value_heads": 32, | |
| "pad_token_id": 0, | |
| "pretraining_tp": 1, | |
| "query_tokens_size": 50, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": null, | |
| "task": "transcribe", | |
| "tie_word_embeddings": false, | |
| "torch_dtype": "float32", | |
| "transformers_version": "4.31.0", | |
| "tune_mm_audio_aligner": true, | |
| "tune_mm_mlp_adapter": false, | |
| "tune_mm_vision_resampler": false, | |
| "unfreeze_mm_vision_tower": false, | |
| "use_cache": true, | |
| "use_mm_proj": true, | |
| "vocab_size": 32000 | |
| } | |