Skip to content

Commit

Permalink
docs(video url) video url example and compatibility info
Browse files Browse the repository at this point in the history
  • Loading branch information
kq-chen authored Sep 24, 2024
1 parent 4a2035c commit d90d8e3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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 |||
</details>

<details>
Expand Down

0 comments on commit d90d8e3

Please sign in to comment.