Unverified Commit fc6d0c29 authored by Reid's avatar Reid Committed by GitHub
Browse files

[Misc] improve docs (#18734)


Signed-off-by: default avatarreidliu41 <reid201711@gmail.com>
Co-authored-by: default avatarreidliu41 <reid201711@gmail.com>
parent 753944fa
...@@ -15,40 +15,46 @@ prompts = [ ...@@ -15,40 +15,46 @@ prompts = [
"What is annapurna labs?", "What is annapurna labs?",
] ]
# Create a sampling params object.
sampling_params = SamplingParams(top_k=1, max_tokens=500, ignore_eos=True) def main():
# Create a sampling params object.
# Create an LLM. sampling_params = SamplingParams(top_k=1, max_tokens=500, ignore_eos=True)
llm = LLM(
model="/home/ubuntu/model_hf/Meta-Llama-3.1-70B-Instruct", # Create an LLM.
speculative_config={ llm = LLM(
"model": "/home/ubuntu/model_hf/Llama-3.1-70B-Instruct-EAGLE-Draft", model="/home/ubuntu/model_hf/Meta-Llama-3.1-70B-Instruct",
"num_speculative_tokens": 5, speculative_config={
"max_model_len": 2048, "model": "/home/ubuntu/model_hf/Llama-3.1-70B-Instruct-EAGLE-Draft",
}, "num_speculative_tokens": 5,
max_num_seqs=4, "max_model_len": 2048,
# The max_model_len and block_size arguments are required to be same as },
# max sequence length when targeting neuron device. max_num_seqs=4,
# Currently, this is a known limitation in continuous batching support # The max_model_len and block_size arguments are required to be same as
# in neuronx-distributed-inference. # max sequence length when targeting neuron device.
max_model_len=2048, # Currently, this is a known limitation in continuous batching support
block_size=2048, # in neuronx-distributed-inference.
# The device can be automatically detected when AWS Neuron SDK is installed. max_model_len=2048,
# The device argument can be either unspecified for automated detection, block_size=2048,
# or explicitly assigned. # The device can be automatically detected when AWS Neuron SDK is installed.
device="neuron", # The device argument can be either unspecified for automated detection,
tensor_parallel_size=32, # or explicitly assigned.
override_neuron_config={ device="neuron",
"enable_eagle_speculation": True, tensor_parallel_size=32,
"enable_fused_speculation": True, override_neuron_config={
}, "enable_eagle_speculation": True,
) "enable_fused_speculation": True,
},
# Generate texts from the prompts. The output is a list of RequestOutput objects )
# that contain the prompt, generated text, and other information.
outputs = llm.generate(prompts, sampling_params) # Generate texts from the prompts. The output is a list of RequestOutput objects
# Print the outputs. # that contain the prompt, generated text, and other information.
for output in outputs: outputs = llm.generate(prompts, sampling_params)
prompt = output.prompt # Print the outputs.
generated_text = output.outputs[0].text for output in outputs:
print(f"Prompt: {prompt!r}, \n\n\n\ Generated text: {generated_text!r}") prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, \n\n\n\ Generated text: {generated_text!r}")
if __name__ == "__main__":
main()
...@@ -6,14 +6,19 @@ This folder provides several example scripts on how to inference Qwen2.5-Omni of ...@@ -6,14 +6,19 @@ This folder provides several example scripts on how to inference Qwen2.5-Omni of
```bash ```bash
# Audio + image + video # Audio + image + video
python examples/offline_inference/qwen2_5_omni/only_thinker.py -q mixed_modalities python examples/offline_inference/qwen2_5_omni/only_thinker.py \
-q mixed_modalities
# Read vision and audio inputs from a single video file # Read vision and audio inputs from a single video file
# NOTE: V1 engine does not support interleaved modalities yet. # NOTE: V1 engine does not support interleaved modalities yet.
VLLM_USE_V1=0 python examples/offline_inference/qwen2_5_omni/only_thinker.py -q use_audio_in_video VLLM_USE_V1=0 \
python examples/offline_inference/qwen2_5_omni/only_thinker.py \
-q use_audio_in_video
# Multiple audios # Multiple audios
VLLM_USE_V1=0 python examples/offline_inference/qwen2_5_omni/only_thinker.py -q multi_audios VLLM_USE_V1=0 \
python examples/offline_inference/qwen2_5_omni/only_thinker.py \
-q multi_audios
``` ```
This script will run the thinker part of Qwen2.5-Omni, and generate text response. This script will run the thinker part of Qwen2.5-Omni, and generate text response.
...@@ -22,11 +27,16 @@ You can also test Qwen2.5-Omni on a single modality: ...@@ -22,11 +27,16 @@ You can also test Qwen2.5-Omni on a single modality:
```bash ```bash
# Process audio inputs # Process audio inputs
python examples/offline_inference/audio_language.py --model-type qwen2_5_omni python examples/offline_inference/audio_language.py \
--model-type qwen2_5_omni
# Process image inputs # Process image inputs
python examples/offline_inference/vision_language.py --modality image --model-type qwen2_5_omni python examples/offline_inference/vision_language.py \
--modality image \
--model-type qwen2_5_omni
# Process video inputs # Process video inputs
python examples/offline_inference/vision_language.py --modality video --model-type qwen2_5_omni python examples/offline_inference/vision_language.py \
--modality video \
--model-type qwen2_5_omni
``` ```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment