From d90d8e31b31607b9aeda7e1d84d4f6f99f6ce3c0 Mon Sep 17 00:00:00 2001 From: kq-chen Date: Tue, 24 Sep 2024 19:30:08 +0800 Subject: [PATCH] docs(video url) video url example and compatibility info --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c99237..6939439 100644 --- a/README.md +++ b/README.md @@ -330,14 +330,13 @@ messages = [ "file:///path/to/frame3.jpg", "file:///path/to/frame4.jpg", ], - "fps": 1.0, }, {"type": "text", "text": "Describe this video."}, ], } ] -# Messages containing a video and a text query +# Messages containing a local video path and a text query messages = [ { "role": "user", @@ -353,6 +352,20 @@ messages = [ } ] +# Messages containing a video url and a text query +messages = [ + { + "role": "user", + "content": [ + { + "type": "video", + "video": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-VL/space_woaudio.mp4", + }, + {"type": "text", "text": "Describe this video."}, + ], + } +] + # Preparation for inference text = processor.apply_chat_template( messages, tokenize=False, add_generation_prompt=True @@ -377,6 +390,14 @@ output_text = processor.batch_decode( ) print(output_text) ``` + +Video URL compatibility largely depends on the third-party library version. The details are in the table below. change the backend by `FORCE_QWENVL_VIDEO_READER=torchvision` or `FORCE_QWENVL_VIDEO_READER=decord` if you prefer not to use the default one. + +| Backend | HTTP | HTTPS | +|-------------|------|-------| +| torchvision >= 0.19.0 | ✅ | ✅ | +| torchvision < 0.19.0 | ❌ | ❌ | +| decord | ✅ | ❌ |